@valuabletouch/winston-seq
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
- Fork it (https://github.com/valıuabletouch/winston-seq/fork)
- Create your feature branch (
git checkout -b feature/<feature_name>
) - Commit your changes (
git commit -am '<type>(<scope>): added some feature'
) - Push to the branch (
git push origin feature/<feature_name>
) - Create a Pull Request
Contributors
- SuperPaintman Creator
- Valuable Touch Maintainer