This library makes it easy to support Seq from Node.js logging libraries, including Winston via winston-seq, Pino via
pino-seq
, Bunyan viabunyan-seq
, and Ts.ED logger via @tsed/logger-seq. It is not expected that applications will interact directly with this package.
A Logger
is configured with serverUrl
, and optionally apiKey
as well as event and batch size limits.
requestTimeout
can be used to adjust timeout for stalled connections, default: 30s.
let process = require('process');
let seq = require('seq-logging');
let logger = new seq.Logger({ serverUrl: 'http://localhost:5341' });
logger.emit({
timestamp: new Date(),
level: 'Information',
messageTemplate: 'Hello for the {n}th time, {user}!',
properties: {
user: process.env.USERNAME,
n: 20
}
});
logger.close();
Events are sent using the emit()
method, that internally performs asynchronous batching based on payload size.
When the application exits, close()
ensures all buffered events are written. This can be done at any time otherwise using the flush()
method. Both of these methods return promises indicating completion.
- bunyan-seq - collect events from the Buyan logging framework
- pino-seq - A stream to send Pino events to Seq
- winston-seq - A Seq transport for Winston
- @tsed/logger-seq - A Seq transport for Ts.ED logger