Socket
Socket
Sign inDemoInstall

seq-logging

Package Overview
Dependencies
9
Maintainers
2
Versions
25
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

seq-logging

Sends structured log events to the Seq HTTP ingestion API


Version published
Maintainers
2
Weekly downloads
24,154
decreased by-13.72%

Weekly downloads

Readme

Source

Seq Logging for JavaScript Build Publish NPM

This library makes it easy to support Seq from Node.js logging libraries, including Winston via winston-seq, Pino via pino-seq, Bunyan via bunyan-seq, and Ts.ED logger via @tsed/logger-seq. It is not expected that applications will interact directly with this package.

Requiring for Node

const seq = require('seq-logging');

Requiring for a browser

Using seq-logging in a browser context is the same, except the module to import is seq-logging/browser.

const seq = require('seq-logging/browser');

Usage

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.

const process = require('process');
const seq = require('seq-logging');

const 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
  • 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

Keywords

FAQs

Last updated on 20 Mar 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc