JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 101028
  • Score
    100M100P100Q167450F
  • License Apache-2.0

Sends structured log events to the Seq HTTP ingestion API

Package Exports

  • seq-logging

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (seq-logging) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Seq Logging for JavaScript Build status NPM

This library makes it easy to support Seq from Node.js logging libraries, initially node-bunyan. 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.