Registry / devops / filestream-logger

filestream-logger

JSON →
library2.2.10jsnpmunverified

A Node.js file-based logger that automatically creates log directories and rotates files by date. Version 2.2.10 supports custom formatters, configurable directory and filename patterns, and extends multiple logger types. It provides synchronous and asynchronous file writing with queued directory creation. Different from Winston or Pino due to minimal dependencies (only Node.js fs module) and a simpler API focused on file logging. Release cadence is low; last release was in 2021. Ships TypeScript type definitions.

npm install filestream-logger
INSTALL
IMPORT
SIG · FILESTREAM-LOGGER
F
filestream-logger
devopsjavascriptv2.2.10
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

FilestreamLogger
const FilestreamLogger = require('filestream-logger')
This package uses CommonJS; no ESM exports provided.
FilestreamLogger
import FilestreamLogger from 'filestream-logger'
import { FilestreamLogger } from 'filestream-logger'
Default import works in TypeScript with esModuleInterop enabled.
constructor
new FilestreamLogger('type', options)
new FilestreamLogger()
First argument (type) is required; without it an error is thrown.

Demonstrates creating a logger with custom formatter, logging messages, and waiting for file writes.

const FilestreamLogger = require('filestream-logger'); // Create a logger with a specific type and options const logger = new FilestreamLogger('app', { dir: 'logs', name: 'myapp', formatter: (data, callback) => { const text = data.map(item => typeof item === 'object' ? JSON.stringify(item) : String(item)).join(' '); callback(new Date().toISOString() + ' ' + text); } }); // Log messages (formatted via the custom formatter) logger.log('This is an info message'); logger.error('This is an error message'); // After logging, wait for writes to complete (optional) setTimeout(() => { console.log('Done'); }, 1000);
Debug
Known issues
gotchaThe 'type' parameter is required; omitting it will cause an error. Always provide a non-empty string.
fix
new FilestreamLogger('valid-type', options)
affects: >=2.0.0
gotchaDirectory and file creation is asynchronous (queued), so logs may not be written immediately. There is no callback or promise returned from log() to know when writes complete.
fix
Use external synchronization (e.g., setTimeout) or listen for uncatchable events.
affects: >=1.0.0
deprecatedThe default formatter uses callback pattern; newer versions may move to async/await. Current callbacks are still supported.
fix
Wrap in promise if needed: new Promise(resolve => logger.log('test', resolve))
affects: 2.x
gotchaFormatters that fail to call callback will cause memory leaks and unhandled errors. Ensure callback is always called exactly once.
fix
Always call callback in formatter, even on error.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: Cannot read property 'join' of undefined
The formatter function is called with a data array, but if you override formatter and don't call callback, or if data is undefined.
fix
Ensure formatter signature is (data, callback) and that data is an array; default formatter is (data, callback) => callback(data.join(' '))
Error: The type parameter is required
Called new FilestreamLogger() without a string argument.
fix
new FilestreamLogger('app')
Error: ENOENT: no such file or directory, open '...'
The directory specified in options.dir does not exist and could not be created (permissions or sync issue).
fix
Ensure directory path is writable and accessible; use absolute paths if needed.
Upgrade
Version history
2.2.10latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
filestream-logger — npm install filestream-logger · libregistry