mlogy
v1.0.3
Published
interface for creating log records
Readme
mlogy
Interface for creating log records
Installation
npm install --save mlogyUsage
The modules assumes loggers are organized in a tree tracked by the parent
attribute however this is managed outside the implementation of the logger.
Logger(context, name, [level])
context
The context contains the shared settings shared between all loggers in a system. The context is stored as
contexton the logger and is allowed to change during the life time of the logger to allow loggers created by libraries to be assimilated into a bigger application logger hierarchydefaultProcessors
A List of processors; functions that accepts a record and somehow modifies it by e.g attaching extra data
proxy
A proxy through which all records should be sent.
name
The name of the logger. By convention a dot.separated.string
level
The minimum level the logger will process records for as either a numeric value or a named level from
standard-levels. If undefined the level of the parent logger is used.
var Logger = require('mlogy')
, ctx = {defaultProcessors: []}
, root = new Logger(ctx, '', 'ERROR')
, other = new Logger(ctx, 'other', 'DEBUG')
other.parent = rootsetLevel
Update the minimum level the logger will process records for
trace(frmt, ...)
debug(frmt, ...)
info(frmt, ...)
warn(frmt, ...)
error(frmt, ...)
critical(frmt, ...)
Send a message at the indicated level
