Détail du package

@valuabletouch/winston-seq

valuabletouch248MIT1.3.0

Another Seq transport for Winston

winston, logging, sysadmin, tools

readme

@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

changelog

1.3.0 - Application name support (2021-11-12)

  • Application name option added
  • SeqEvent creation refactored

1.2.0 - Max lengths for buffer and function src (2021-09-29)

  • Max lengths for buffer added
  • Max lengths for function src added
  • Refactorings

1.1.1 - Circular check improved (2021-08-31)

  • Circular check improved
  • Non-primitive value display improved
  • Circular value display improved

1.1.0 - Info parsing changed (2021-08-31)

  • Info parsing changed
  • TypeScript version updated

1.0.5 - Error fixes (2021-08-27)

  • Prevent transport crash
  • Prevent circular dependency maximum stack size error
  • Run non-blocking

1.0.3 - Fixes and refactorings (2021-08-27)

1.0.2 - TS config fix (2021-08-24)

1.0.1 - TS config fix (2021-08-24)

1.0.0 - Fork from original repo (2021-08-24)

  • winston-transport version updated
  • seq-logging version updated
  • Unused test packages removed
  • Code is simplified
  • Refactorings