class LogWriter
A class that handles log messages, part of the global application context.
class LogWriter
Description
An instance of this class is available as app.log. You can use methods on that instance to write messages to the application log.
Different methods are available for different severity levels, ranging from verbose
(level 0) to fatal
(level 5).
Log messages are emitted as events on LogWriter.emitter. A listener can be added there, or using app.addLogHandler() to add a log ‘sink’ for a minimum severity level. If no listeners have been added, log messages are written to the console.
Type Members
- type LogWriter.LogMessageData staticThe data structure contained by each LogMessageEvent.
- type LogWriter.LogMessageEvent staticAn event that’s emitted by the application log writer for each log message.
Instance Members
- verbose(message)Writes a log message with severity ‘verbose’ (0).
- debug(message)Writes a log message with severity ‘debug’ (1).
- information(message)Writes a log message with severity ‘information’ (2).
- warning(message)Writes a log message with severity ‘warning’ (3).
- error(message)Writes a log message with severity ‘error’ (4).
- fatal(message)Writes a log message with severity ‘fatal’ (5).
- emitterAn event emitter for all log messages, emits events of type LogWriter.LogMessageEvent.
More information
For more information, refer to the following page:
- Errors and loggingUnderstand how errors are handled, and how you can use built-in logging features to help observe and debug your application.