gunsen
TypeScript icon, indicating that this package has built-in type declarations

1.4.0 • Public • Published

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

Package Sidebar

Install

npm i gunsen

Weekly Downloads

7

Version

1.4.0

License

MIT

Unpacked Size

8.29 kB

Total Files

6

Last publish

Collaborators

  • seldszar