1.4.0 • Published 5 years ago

gunsen v1.4.0

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

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

1.4.0

5 years ago

1.3.1

5 years ago

1.3.0

5 years ago

1.2.0

5 years ago

1.1.0

5 years ago

1.0.0

6 years ago