1.0.4 • Published 3 years ago

winston-seq-updated v1.0.4

Weekly downloads
13,519
License
MIT
Repository
-
Last release
3 years ago

winston-seq

Linux Build Test Coverage Commitizen friendly NPM version NPM Downloads

Like winston-seq but supports https


Installation

$ npm install --save winston-seq
# Or with yarn
$ yarn add winston-seq

Usage

'use strict';
import { Logger } from 'winston';
import { Seq }    from 'winston-seq';

const logger = new Logger({
  transports: [
    new Seq({
      serverUrl:  'http://127.0.0.1:5341'
      /* apiKey:     '7fs2V60izlkgau2ansjH' */
    })
  ]
});

or

'use strict';
var winston = require('winston');

/**
  * Requiring `winston-seq` will expose
  * `winston.transports.Seq`
  */
require('winston-seq');

winston.add(winston.transports.Seq, {
  serverUrl:  'http://127.0.0.1:5341'
  /* apiKey:     '7fs2V60izlkgau2ansjH' */
});

Use non-standard levels? Overwrite the mapper:

// ...

const logger = new Logger({
  transports: [
    new Seq({
      levelMapper(level = '') {
        switch (level.toLowerCase()) {
          /**  Winston Level    ->     Seq Level */
          case 'error':         return 'Error';
          case 'warn':          return 'Warning';
          case 'info':          return 'Information';
          case 'debug':         return 'Debug';
          case 'verbose':       return 'Verbose';
          case 'silly':         return 'Verbose';
          case 'fatal':         return 'Fatal';
          default:              return 'Information';
        }
      }
    })
  ]
});

// ...

Build

$ npm install
$ # or
$ yarn
$
$ npm run build

Test

$ npm run test

Contributing

  1. Fork it (https://github.com/SuperPaintman/winston-seq/fork)
  2. Create your feature branch (git checkout -b feature/<feature_name>)
  3. Commit your changes (git commit -am '<type>(<scope>): added some feature')
  4. Push to the branch (git push origin feature/<feature_name>)
  5. Create a new Pull Request

Contributors


Changelog

Changelog


License

MIT