@valuabletouch/winston-seq
TypeScript icon, indicating that this package has built-in type declarations

1.3.0 • Public • Published

@valuabletouch/winston-seq

NPM version NPM Downloads

Another Seq transport for Winston

Installation

$ npm install --save @valuabletouch/winston-seq

# Or with yarn
$ yarn add @valuabletouch/winston-seq

Usage

import { createLogger } from 'winston';
import { Transport as SeqTransport } from 'winston-seq';

const logger = createLogger({
  transports: [
    new SeqTransport({
      serverUrl: 'http://127.0.0.1:5341'
    })
  ]
});

Options object is a merge of the TransportStreamOptions interface of 'winston-transport' and SeqLoggerConfig interface of 'seq-logging':

interface IOption {
  format?: Format;
  level?: string;
  silent?: boolean;
  handleExceptions?: boolean;

  serverUrl?: string;
  apiKey?: string;
  maxBatchingTime?: number;
  eventSizeLimit?: number;
  batchSizeLimit?: number;
  requestTimeout?: number;
  maxRetries?: number;
  retryDelay?: number;
  onError?: ErrorHandler;
  onRemoteConfigChange?: RemoteConfigChangeHandler;

  levelMapper?: LevelMapperHandler;
  maxBufferLength?: number;
  maxFunctionSourceLength?: number;
}

Using non-standard levels? Transform them with levelMapper:

const logger = createLogger({
  transports: [
    new SeqTransport({
      levelMapper(level = '') {
        switch (level?.toLowerCase()) {
          // Winston   ->  Seq
          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

$ npm run build

Contributing

  1. Fork it (https://github.com/valıuabletouch/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 Pull Request

Contributors

Changelog

Changelog

License

MIT

Package Sidebar

Install

npm i @valuabletouch/winston-seq

Weekly Downloads

18

Version

1.3.0

License

MIT

Unpacked Size

24.6 kB

Total Files

7

Last publish

Collaborators

  • mehyaa
  • ensarihakan