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
- 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