Class dlog
Library for writing to and accessing a debug log. Each log entry has a date, some identifying information, a severity, and a message body. Exceptions that cause requests to fail are automatically logged at severity level FATAL. Limits: Currently only the most recent 1000-1500 messages are stored, and bodies may be up to 1k in length.
Defined in: <lib\dlog.js>.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
dlog()
Library for writing to and accessing a debug log.
|
| Field Attributes | Field Name and Description |
|---|---|
| <static> |
dlog.ERROR
Severity level ERROR.
|
| <static> |
dlog.FATAL
Severity level FATAL.
|
| <static> |
dlog.INFO
Severity level INFO.
|
| <static> |
dlog.WARN
Severity level WARN.
|
| Method Attributes | Method Name and Description |
|---|---|
| <static> |
dlog.clear()
Clears the debug log. |
| <static> |
dlog.error(message, etc)
Logs an error message. |
| <static> |
dlog.fatal(message, etc)
Logs a fatal message. |
| <static> |
dlog.info(message, etc)
Logs an info message. |
| <static> |
dlog.log(severity, message, etc)
Writes a message of the given severity to the debug log. |
| <static> |
dlog.messages(params)
Provides programmatic access to the debug log's messages (for making your own dashboard, perhaps?). |
| <static> |
dlog.warn(message, etc)
Logs a warning message. |
Clears the debug log.
Logs an error message. "Error" is generally used when something bad and unexpected has happened.
- Parameters:
- {*} message
- The message to log.
- {*} etc
- ...
Logs a fatal message. "Fatal" is generally used to indicate that execution cannot continue.
- Parameters:
- {*} message
- The message to log.
- {*} etc
- ...
Logs an info message. "Info" is generally used to note that something interesting has happened.
- Parameters:
- {*} message
- The message to log.
- {*} etc
- ...
Writes a message of the given severity to the debug log. In addition to the severity and message text, the debug log also tracks: the time the message is logged; the ID of the request that generated the message; and the type (preview, published, or shell) of the request that generated the message.
- Parameters:
- {number} severity
- The severity of the message.
- {*} message
- The message to log.
- {*} etc
- ...
Provides programmatic access to the debug log's messages (for making your own dashboard, perhaps?).
The returned objects have fields that correspond to all recorded information about the message, namely:
- date: the message's date, in milliseconds since the epoch (UNIX time), suitable for passing to the Date constructor.
- requestId: the ID of the request that logged this message.
- requestType: the type of the request that logged this message ("preview", "published", or "shell").
- severity: the severity of the message.
- message: the logged message text.
- Parameters:
- {object} params Optional
- Optional object with the following six optional properties:
- {number} params.howOld Optional
- How far back (in milliseconds) to access logged messages. Default: 1 hour.
- {string} params.idFilter Optional
- Only show messages created with this request ID. Default: no rescriction.
- {boolean} params.preview Optional
- true to show messages generated from preview requests. Default: true.
- {boolean} params.published Optional
- true to show messages generated from requests to the published app. Default: true.
- {boolean} params.shell Optional
- true to show messages generated by the shell. Default: false.
- {number} params.maxSeverity Optional
- The least severe message severity to show (all messages with a severity level more or equally severe will be returned). Default: 4.
- Returns:
- {array} An array of objects describing the logged messages.
Logs a warning message. "Warn" is generally used when something unexpected happened - perhaps a harbinger of greater errors to come.
- Parameters:
- {*} message
- The message to log.
- {*} etc
- ...