Registry / observability / log-driver

log-driver

JSON →
library1.2.7jsnpmunverified

Log Driver is a minimalistic Node.js logging framework, currently at version 1.2.7. It is designed exclusively to output all logs to standard output (stdout), following a Unix-like philosophy. Its core differentiator is the complete decoupling of log processing from the application itself, advocating for external tools and operating system pipes (e.g., `2>&1 | logger` or `>> somefile.log`) to handle persistence, routing, and filtering of logs. The package provides configurable log levels (e.g., error, warn, info, debug, trace) and allows for custom formatting functions, including JSON output. Unlike many contemporary logging libraries, Log Driver does not include built-in transports for files, network, or databases. The project appears to be abandoned, with its last publish occurring 8 years ago as of February 2018, implying no active release cadence or maintenance.

npm install log-driver
INSTALL
IMPORT
SIG · LOG-DRIVER
L
log-driver
observabilityjavascriptv1.2.7
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
const logger = require('log-driver').logger;
import { logger } from 'log-driver';
This package is CommonJS-only and primarily used via direct property access on the module export. Attempting to use `import` syntax will result in errors in an ESM context.
default export (factory)
const customLogger = require('log-driver')({ level: 'info' });
import customLogger from 'log-driver';
The default export is a factory function for creating new logger instances with custom configurations. It is CommonJS-only; direct ESM default imports are not supported.
Logger instances
logger.info('message');
logger.log('info', 'message');
Logger instances expose level-specific methods (e.g., `.info()`, `.warn()`, `.error()`) rather than a generic `.log()` with a level argument.

Demonstrates how to get the default logger, configure a logger with custom levels and thresholds, and apply a custom JSON formatting function, highlighting its stdout-centric design.

const logDriver = require('log-driver'); // Get the default logger instance const defaultLogger = logDriver.logger; defaultLogger.info('Application started at %s', new Date().toISOString()); defaultLogger.warn('Potential issue: %j', { severity: 'medium', reason: 'Resource nearing limit' }); defaultLogger.error(new Error('Something critical happened!'), 'An unexpected error occurred.'); // Configure a custom logger with specific levels and a lower threshold const customLevelsLogger = logDriver({ levels: ['audit', 'critical', 'notify'], level: 'critical' // Only log 'critical' and 'audit' }); customLevelsLogger.audit('User %s performed action %s', 'admin', 'login'); customLevelsLogger.critical('Database connection lost!'); customLevelsLogger.notify('New update available (this will not show)'); // Below 'critical' level // Demonstrate a custom formatter for JSON output const jsonLogger = logDriver({ format: function() { const args = Array.from(arguments); const level = args.shift(); // First arg is the log level implicitly passed by the method const timestamp = new Date().toISOString(); return JSON.stringify({ timestamp, level, message: args.map(arg => typeof arg === 'object' ? JSON.stringify(arg) : String(arg)).join(' ') }); } }); jsonLogger.info('This is a JSON log message', { data: 'example', id: 123 }); // To experience log-driver's full effect, run this script and pipe its output: // node your-app.js 2>&1 | tee app.log | some-log-processor.js
Debug
Known issues
breakingThe `log-driver` package is abandoned and has not received updates since February 2018. This implies a lack of security patches, bug fixes, and compatibility updates for newer Node.js versions or evolving ecosystem standards. Continued use in production environments is highly risky.
fix
Migrate to a actively maintained logging solution such as Winston, Pino, or pino-pretty, which offer robust features, performance, and ongoing support.
affects: >=1.x.x
gotchaThis package is CommonJS-only and does not support ES Modules (`import`/`export`). Attempting to use `log-driver` in an ESM context will lead to runtime errors.
fix
Ensure `log-driver` is used only in CommonJS modules with `require()`. For projects using ES Modules, consider migrating to an ESM-compatible logging library or using a CommonJS wrapper.
affects: All versions
gotchaLog Driver's design relies heavily on operating system-level piping for log persistence and transport (e.g., sending to files, syslog, or external services). It does not provide built-in transports like modern logging libraries.
fix
Users must implement external piping mechanisms (e.g., shell redirection `>>`, or piping to tools like `logger` or custom scripts) to achieve log storage or forwarding beyond `stdout`/`stderr`.
affects: All versions
gotchaThe package's `engines` field specifies Node.js `>=0.8.6`, which is an extremely old and unsupported version of Node.js. While it might still function on newer Node.js runtimes, unexpected behavior, deprecation warnings, or outright compatibility issues are highly probable due to unmaintained dependencies or breaking changes in Node.js itself.
fix
Thoroughly test `log-driver` on your target Node.js version. For production, prioritize migration to a actively maintained logger that explicitly supports modern Node.js versions.
affects: All versions on modern Node.js (>v8)
Errors
Common errors & fixes
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension in <module path> for <log-driver module path>
Attempting to `import` the CommonJS-only `log-driver` package in an ES Module context (e.g., a `.mjs` file or a project with `"type": "module"` in `package.json`).
fix
Use `const logDriver = require('log-driver');` instead of `import` statements. If your project is pure ESM, consider migrating to an ESM-compatible logging library.
TypeError: logger.trace is not a function
The logger instance was initialized with a `level` option that is higher (less verbose) than 'trace', effectively disabling the `trace` method. For example, setting `level: 'info'` will disable `debug` and `trace` methods.
fix
Ensure the logger is configured with a sufficiently low `level` to enable the desired methods. For 'trace' output, initialize with `require('log-driver')({ level: 'trace' })` or lower.
ReferenceError: require is not defined
`log-driver` is a Node.js-specific package that uses Node.js's `require` function, which is not available in client-side browser environments.
fix
This package is not designed for browser use. For client-side logging, use browser-native `console` methods or a browser-compatible logging library (e.g., `loglevel`).
Upgrade
Version history
1.2.7latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
7 hits · last 30 days
node
6
OpenAI (training)
1
Resources