@mck-p/logger
v0.0.1
Published
A Node logging wrapper for the McK-P services
Downloads
5
Readme
@mck-p/logger
Overview
This package is a wrapper around logging that offers a uniform interface for all @mck-p
services.
Usage
const createLogger = require("@mck-p/logger");
const logger = createLogger({
name: "SERVICE_NAME" /* defaults to process.env.SERVICE_NAME */,
level: "trace" /* defaults to process.env.LOG_LEVEL */
serializers: {}, /* defaults to bunyan.stdSerializers */
/* any other bunyan options will be copied over */
});
logger.trace("Some event happened.")
logger.warn(error, "Some Error happened.")
logger.fatal(error, "We are exiting one after a fatal error!")
Levels
fatal
(60): The service/app is going to stop or become unusable now. An operator should definitely look into this soon.error
(50): Fatal for a particular request, but the service/app continues servicing other requests. An operator should look at this soon(ish).warn
(40): A note on something that should probably be looked at by an operator eventually.info
(30): Detail on regular operation.debug
(20): Anything else, i.e. too verbose to be included ininfo
level.trace
(10): Logging from external libraries used by your app or very detailed application logging.