X-Git-Url: http://git.squeep.com/?p=squeep-logger-json-console;a=blobdiff_plain;f=README.md;fp=README.md;h=d5177524fc4bd1b87bd1dbd3ccba3f5c81a7276b;hp=9188471090b815206d79b4f46fccbd497d2ddc27;hb=5f6029bc6c75708175ade99f6c44beb1d0e2817a;hpb=9df1ebe7b067a00a012b1deb303278e51a711e37 diff --git a/README.md b/README.md index 9188471..d517752 100644 --- a/README.md +++ b/README.md @@ -4,18 +4,26 @@ A simple logger class, which mostly just structures messages, data, and some met Supports basic scrubbing of well-defined sensitive fields, and an extensible set of JSON replacer functions for common objects. -If provided with an asyncLocalStorage instance, it expects a stored object which will be spread over the resulting logged json, taking precedence. +If provided with an asyncLocalStorage instance, it expects a stored object which will be spread over the resulting logged JSON. -Intended to be specific to Squeep Framework Applications, this module has opinions. +Intended to be specific to Squeep Framework Applications, this module has some opinions. ## API -Expects these arguments in any log call: - -- `scope` - e.g. file:method -- `message` - text -- `data` - object -- any additional arguments are included as an array, but not scrubbed +- `new Logger(options, commonObject, asyncLocalStorage, backend)` + - `commonObject` will be merged into every log + - `asyncLocalStorage`, if provided, should store an object, which will also be merged into log + - `backend` is `console` by default, but may be anything implementing the same log-level functions + +- `error(scope, message, data, ...)` + - `scope` - identifies source of message, e.g. 'class:method' + - `message` - text to be logged + - `data` - object to be logged, can be scrubbed of sensitive fields, and will be serialized with provided replacers + - any additional arguments are included as an array +- `warn(scope, message, data, ...)` +- `info(scope, message, data, ...)` +- `log(scope, message, data, ...)` +- `debug(scope, message, data, ...)` ## JSON Replacers @@ -27,11 +35,11 @@ Includes replacers for these objects: - http.OutgoingMessage - http.ServerResponse -Custom replacers may be inserted into the logger instance's `jsonReplacers` array. +Additional replacers may be inserted into the logger instance's `jsonReplacers` array. ## Data Sanitizers -Custom sanitizers may be inserted into the logger instance's `dataSanitizers` array. +Sanitizers may be inserted into the logger instance's `dataSanitizers` array. ## Example