Log Object functionalities

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 DescriptionLogs 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.
Returnsvoid
Supported Script TypesClient and server scriptsFor more information
GovernanceAmount of logging in any 60 minute period is limited
ParameterTypeRequired / OptionalDescription
options.titlestringrequiredThe 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.detailsanyoptionalThe 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 DescriptionLogs 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.
Returnsvoid
Supported Script TypesClient and server scriptsFor more information
GovernanceAmount of logging in any 60 minute period is limited. 
ParameterTypeRequired / OptionalDescription
options.titlestringrequiredThe 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.detailsanyoptionalYou 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 DescriptionLogs 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.
Returnsvoid
Supported Script TypesClient and server scriptsFor more information
GovernanceAmount of logging in any 60 minute period is limited
ParameterTypeRequired / OptionalDescription
options.titlestringrequiredThe 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.detailsanyoptionalThe 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 DescriptionLogs 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.
Returnsvoid
Supported Script TypesClient and server scriptsFor more information
GovernanceAmount of logging in any 60 minute period is limited
ParameterTypeRequired / OptionalDescription
options.titlestringrequiredThe 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.detailsanyoptionalThe 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.

Leave a comment

Your email address will not be published. Required fields are marked *