New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@sourceregistry/node-logger

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sourceregistry/node-logger

Advanced, pluggable logger for Node.js with multiple transport and formatting options. [WIP]

latest
Source
npmnpm
Version
1.0.3
Version published
Maintainers
1
Created
Source

🧠 @sourceregistry/node-logger – Advanced Logging Framework [WORK IN PROGRESS]

A powerful, pluggable TypeScript logger for Node.js applications.
Supports JSON, text, CEF, and Syslog formatting, multiple transport targets (console, file, HTTP, Elasticsearch), and auto-flush strategies for production-grade logging.

🚀 Features

  • Log Levels: TRACE, DEBUG, INFO, WARN, ERROR, FATAL
  • Formatters:
    • JSONFormatter – machine-readable
    • TextFormatter – human-friendly
    • CEFFormatter – Common Event Format for SIEM
    • SyslogFormatter – Syslog-compatible format
  • Transports:
    • ConsoleTransport
    • FileTransport, BufferedFileTransport, SmartFileTransport
    • HTTPTransport, ElasticsearchTransport
    • WorkerTransport – offload to worker thread
  • Auto-flushing: Configurable by interval, size, severity, and idle timeout
  • Tagging & Contextual Logging
  • Asynchronous-safe, fault-tolerant design

📦 Installation

npm install @sourceregistry/node-logger

🛠 Usage

Basic Logger

import { Console, LogLevel } from '@sourceregistry/node-logger';

const logger = Console(LogLevel.DEBUG);
logger.info('App started');
logger.debug('Debugging details');

File Logger with JSON output

import { File } from '@sourceregistry/node-logger';

const fileLogger = File('./logs/app.log');
fileLogger.info('Writing to log file');

Elasticsearch Integration

import { Elasticsearch } from '@sourceregistry/node-logger';

const esLogger = Elasticsearch({
  endpoint: 'https://es.example.com/_bulk',
  apiKey: 'your-api-key',
  index: 'logs'
});

esLogger.error('Something went wrong!');

🧩 Advanced Features

Smart File Logging

import { SmartFileTransport, Logger, LogLevel } from '@sourceregistry/node-logger';

const logger = new Logger(LogLevel.INFO, [
  new SmartFileTransport('./logs/smart.log', undefined, LogLevel.INFO, {
    enabled: true,
    interval: 5000,
    onSize: 50,
    onLevel: LogLevel.ERROR,
    onIdle: 10000
  })
]);


// DEMONSTRATION:
logger.info('This will be buffered');
logger.debug('This will also be buffered');
// ... After 5 seconds, both logs auto-flush to disk

logger.error('This flushes immediately!'); // Because onLevel: ERROR
logger.warn('This will auto-flush based on smart rules'); // Because onLevel: WARNING


Tagged Logger

const taggedLogger = logger.withTags('auth', 'payment');
taggedLogger.info('User logged in');

🧼 Graceful Shutdown

process.on('SIGTERM', async () => {
  await logger.close();
  process.exit(0);
});

📜 License

Apache-2.0

🤝 Contributing

We welcome issues, feature requests, and pull requests!

Keywords

logger

FAQs

Package last updated on 09 Nov 2025

Did you know?

Socket

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