gunsen
v1.4.0
Published
Wrapper for Winston appending metadata to messages
Downloads
2
Maintainers
Readme
Gunsen
Lacerate attackers with two razorsharp warfans.
Wrapper for Winston appending metadata to messages.
Table of Contents
Installation
npm install gunsen --save
Usage
const gunsen = require("gunsen");
const winston = require("winston");
const logger = new gunsen.Logger(
winston.createLogger({
format: winston.format.simple(),
transports: [new winston.transports.Console()],
}),
);
// Creates a sub-logger with the given metadata
const sub = logger.child({ username: "Seldszar" });
// Outputs: "error: I don't have metadata."
logger.error("I don't have metadata.");
// Outputs: "info: Hello from this user! {"username":"Seldszar"}"
sub.info("Hello from this user!");
// Outputs: "warn: I can also do that! {"date":1529682533839,"username":"Seldszar"}"
sub.log({ level: "warn", message: "I can also do that!", date: Date.now() });
Author
Alexandre Breteau - @0xSeldszar
License
MIT © Alexandre Breteau