1.1.5 • Published 3 months ago

@nooks-ai/nooks-logger v1.1.5

Weekly downloads
-
License
ISC
Repository
github
Last release
3 months ago

Classes

Logger

new Logger(serviceName, options)

Creates a JSON Logger for Node Applications

ParamTypeDescription
serviceNameStringName of the service or application.
optionsObjectConfiguration options.
options.levelStringMinimum level logged. Static fields are provided for convenience: Logger.DEBUG, Logger.INFO, Logger.WARN, Logger.ERROR, and Logger.FATAL. Defaults to Logger.INFO.
options.metadataObjectInitial fields to include with every log from logger instance

logger.debug(message, data)

Writes a debug JSON log to the console.

ParamTypeDescription
messagestringlog message.
metadataObjectextra metadata associated with the log.

logger.info(message, data)

Writes an info JSON log to the console.

ParamTypeDescription
messagestringlog message.
metadataObjectextra metadata associated with the log.

logger.warn(message, data)

Writes a warning JSON log to the console.

ParamTypeDescription
messagestringlog message.
metadataObjectextra metadata associated with the log.

logger.error(message, data)

Writes an error JSON log to the console.

ParamTypeDescription
messagestringlog message.
metadataObjectextra metadata associated with the log.

logger.fatal(message, data)

Writes a fatal JSON log to the console.

ParamTypeDescription
messagestringlog message.
metadataObjectextra metadata associated with the log.

logger.err(error) ⇒ Logger

Creates a new logger with the error field set at root to be serialized nicely.

Returns: Logger - returns child logger to log a unit of work.

ParamTypeDescription
errorErrora javascript Error.

logger.data(data) ⇒ Logger

Chainable command to define extra metadata to be included in all subsequent logs.

Returns: Logger - returns child logger that will include extra metadata in all subsequent logs.

ParamTypeDescription
dataObjecttop-level data to add to logs.
1.1.5

3 months ago

1.1.1

10 months ago

1.1.0

11 months ago

1.1.4

10 months ago

1.0.5

10 months ago

1.1.3

10 months ago

1.1.2

10 months ago

1.0.4

11 months ago