Registry / observability / seq-logging

seq-logging

JSON →
library3.0.0jsnpmunverified

seq-logging is a JavaScript library designed to send structured log events to the Seq HTTP ingestion API. It is currently at version 3.0.0 and serves as a low-level client, primarily intended for use by other logging frameworks and their respective Seq transports (e.g., winston-seq, pino-seq, bunyan-seq, @tsed/logger-seq), rather than for direct application interaction. The library handles asynchronous batching of log events based on payload size and provides mechanisms to ensure all buffered events are sent upon application exit or explicit flushing. Its key differentiator is acting as the foundational communication layer for Seq within the JavaScript ecosystem, offering both Node.js and browser-specific builds, and explicitly supports ESM.

npm install seq-logging
INSTALL
IMPORT
SIG · SEQ-LOGGING
S
seq-logging
observabilityjavascriptv3.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Logger
import { Logger } from 'seq-logging'
const { Logger } = require('seq-logging')
Starting with v3, seq-logging is an ESM-only package. CommonJS `require()` is not supported for the main entry point.
Logger
import { Logger } from 'seq-logging/browser'
const { Logger } = require('seq-logging/browser')
For browser environments, use the dedicated `seq-logging/browser` entry point. CommonJS `require()` is not supported for v3.
LoggerOptions
import type { LoggerOptions } from 'seq-logging'
Type-only import for configuring the Logger instance, especially when using TypeScript.

Initializes a Seq Logger and emits a structured log event with properties, demonstrating basic usage and proper shutdown.

import process from 'process'; import { Logger } from 'seq-logging'; const logger = new Logger({ serverUrl: process.env.SEQ_SERVER_URL ?? 'http://localhost:5341', apiKey: process.env.SEQ_API_KEY ?? undefined, // Optional requestTimeout: 30000 // default to 30s }); logger.emit({ timestamp: new Date(), level: 'Information', messageTemplate: 'Hello from {appName}! It is {currentTime}.', properties: { appName: 'MySeqApp', currentTime: new Date().toISOString(), user: process.env.USERNAME ?? 'anonymous' } }); // Ensure all buffered events are sent before exiting logger.close().then(() => console.log('Logger closed successfully.'));
Debug
Known issues
breakingVersion 3.0.0 and later are ESM-only, meaning CommonJS `require()` syntax is no longer supported for importing the library. Attempting to use `require()` will result in import errors.
fix
Migrate your import statements to use ES module syntax (e.g., `import { Logger } from 'seq-logging'`). If using Node.js, ensure your project is configured for ESM (e.g., `"type": "module"` in package.json or using `.mjs` file extension).
affects: >=3.0.0
gotchaEvents are buffered internally for asynchronous batching. If the application exits before `close()` or `flush()` is called, buffered events may be lost.
fix
Always call `logger.close()` or `logger.flush()` before your application terminates to ensure all pending events are sent to Seq. Both methods return a Promise, which should be awaited.
affects: >=1.0.0
gotchaWhen targeting browser environments, a different entry point must be used (`seq-logging/browser`) compared to Node.js environments (`seq-logging`).
fix
Ensure your build system (e.g., Webpack, Rollup) or direct imports use `import { Logger } from 'seq-logging/browser'` when bundling for browsers, and `import { Logger } from 'seq-logging'` for Node.js.
affects: >=1.0.0
gotchaThe package requires Node.js version 14.18 or higher. Running on older Node.js versions may lead to unexpected errors or compatibility issues.
fix
Upgrade your Node.js environment to version 14.18.0 or newer to ensure full compatibility and access to required features.
affects: <3.0.0
Errors
Common errors & fixes
TypeError: require is not a function
Attempting to use CommonJS `require()` to import `seq-logging` in a project configured for ESM, or in `seq-logging` v3+ which is ESM-only.
fix
Change `const { Logger } = require('seq-logging');` to `import { Logger } from 'seq-logging';` and ensure your project is set up for ES Modules.
ReferenceError: process is not defined
Attempting to use `process` global in a browser environment without proper polyfill or a Node.js specific build setup.
fix
When building for browsers, avoid direct use of Node.js globals like `process`. If environment variables are needed, pass them in at build time or use a browser-compatible method. Alternatively, ensure your bundler provides a `process` polyfill.
Upgrade
Version history
3.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
19 hits · last 30 days
node
16
OpenAI (training)
2
Resources
seq-logging — npm install seq-logging · libregistry