UNPKG

@datalust/winston-seq

Version:
37 lines 1.15 kB
import * as seq from 'seq-logging'; import TransportStream from 'winston-transport'; export class SeqTransport extends TransportStream { constructor(opts) { super(opts); this.logger = new seq.Logger(opts); setImmediate(() => this.emit('opened')); } log(info, next) { setImmediate(() => this.emit('logged', info)); const { level, message, exception, stack, ...props } = info; this.logger.emit({ timestamp: props.timestamp || new Date(), level: level, messageTemplate: message, properties: props, exception: exception || stack }); next(); } close() { this.logger.close(); setImmediate(() => this.emit('closed')); } flush() { return this.logger.flush(); } } if (!String.prototype.startsWith) { Object.defineProperty(String.prototype, 'startsWith', { value: function (search, rawPos) { const pos = rawPos > 0 ? rawPos | 0 : 0; return this.substring(pos, pos + search.length) === search; }, }); } //# sourceMappingURL=index.js.map