A Node.js client for the Seq HTTP ingestion API
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.vscode
example
test
.gitignore
LICENSE
README.md
appveyor.yml
index.js
package-lock.json
package.json
seq_logger.js

README.md

Seq Logging for JavaScript Build status NPM

This library makes it easy to support Seq from Node.js logging libraries, initially Bunyan via bunyan-seq. It is not expected that applications will interact directly with this package.

Usage

A Logger is configured with serverUrl, and optionally apiKey as well as event and batch size limits.

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.

Implementations

  • bunyan-seq - collect events from the Buyan logging framework