NetSuite loads the log Object by default for all script types. You do not need to load it manually. However, you can choose to load it using the N/log Module, for testing purposes.
log Object Members
log.debug(options)
log.audit(options)
log.emergency(options)
log.error(options)
log.debug(options)
Method Description
Logs a Debug message.Debug messages appear on the Execution tab only if the Log Level on the script deployment is set to Debug.Use this method for scripts in development.
Returns
void
Supported Script Types
Client and server scriptsFor more information
Governance
Amount of logging in any 60 minute period is limited
Parameter
Type
Required / Optional
Description
options.title
string
required
The text to appear in the Title column on the Execution Log tab of the script deployment.Maximum length is 99 characters.If you set this value to null, an empty string (”), or omit it, the word “Untitled” appears for the log entry.
options.details
any
optional
The text of the log message, that can include strings, variables, objects, etc.If the value is a JavaScript object type, JSON.stringify(obj) is called on the object before displaying the value.NetSuite truncates any resulting string over 3999 characters.
log.audit(options)
Method Description
Logs an Audit message.Audit messages appear on the Execution Log tab if the Log Level on the script deployment is set to Audit or Debug.Use this method for scripts in production.
Returns
void
Supported Script Types
Client and server scriptsFor more information
Governance
Amount of logging in any 60 minute period is limited.
Parameter
Type
Required / Optional
Description
options.title
string
required
The text to appear in the Title column on the Execution Log tab of the script deployment.Maximum length is 99 characters. If you set this value to null, an empty string (”), or omit it, the word “Untitled” appears for the log entry.
options.details
any
optional
You can pass any value for this parameter.If the value is a JavaScript Object type, JSON.stringify(obj) is called on the object before displaying the value.NetSuite truncates any resulting string over 3999 characters.
log.emergency(options)
Method Description
Logs an Emergency message.Emergency messages appear on the Execution tab only if the Log Level on the script deployment is set to Audit, Debug, Error, or Emergency. In other words, emergency messages always appear.Use this method for scripts in production.
Returns
void
Supported Script Types
Client and server scriptsFor more information
Governance
Amount of logging in any 60 minute period is limited
Parameter
Type
Required / Optional
Description
options.title
string
required
The text to appear in the Title column on the Execution Log tab of the script deployment.Maximum length is 99 characters. If you set this value to null, an empty string (”), or omit it, the word “Untitled” appears for the log entry.
options.details
any
optional
The text of the log message, that can include strings, variables, objects, etc.If the value is a JavaScript Object type, JSON.stringify(obj) is called on the object before displaying the value.NetSuite truncates any resulting string over 3999 characters.
log.error(options)
Method Description
Logs an Error message.Error messages appear on the Execution tab only if the Log Level on the script deployment is set to Audit, Debug, or Error.Use this method for scripts in production.
Returns
void
Supported Script Types
Client and server scriptsFor more information
Governance
Amount of logging in any 60 minute period is limited
Parameter
Type
Required / Optional
Description
options.title
string
required
The text to appear in the Title column on the Execution Log tab of the script deployment.Maximum length is 99 characters. If you set this value to null, an empty string (”), or omit it, the word “Untitled” appears for the log entry.
options.details
any
optional
The text of the log message, that can include strings, variables, objects, etc.If the value is a JavaScript object type, JSON.stringify(obj) is called on the object before displaying the value.NetSuite truncates any resulting string over 3999 characters.