npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@abimongo/logger

v2.0.0

Published

![npm version](https://img.shields.io/npm/v/@abimongo/logger.svg) ![Release workflow](https://github.com/NodEm9/abimongo/actions/workflows/release.yml/badge.svg)

Downloads

19

Readme

abimongo_logger

npm version Release workflow

A modular utility library for Node.js projects, starting with a robust, extensible logger utility. This library is designed to be expanded with additional utilities over time, making it a central toolkit for your backend applications.


Release Notes — v2.0.0

Released: 2025-11-09

  • Major bump to @abimongo/logger -> 2.0.0.
  • Fix: GraphQL-related issues in the core package have been addressed so consumers using Abimongo Core will not encounter runtime logging errors related to transport shapes.
  • Fix: Improved robustness when consumers configure transports (defensive checks to avoid runtime TypeError when a transport entry is undefined).
  • Fix: Buffered -> file transport flush behavior improved so buffered logs reach the file transport promptly.
  • Misc: Docs, metrics card updates, and packaging improvements.

Upgrade notes:

  • This is a major release. Please test in staging before upgrading production.
  • If you previously passed transport factory references, ensure you follow the transport API: pass either an instantiated transport object (has .write or .log) or a function-style transporter (async (message, meta) => ...) as appropriate.

Features

  • Advanced Logger Utility
    • Customizable log levels (info, debug, error, etc.)
    • Pluggable transporters (console, file, custom)
    • Hooks for log and error events
    • Metadata enrichment
    • Source-based log exclusion
    • TypeScript support

Installation

npm install @abimongo/logger

Logger Usage

Logger Utility

Basic Setup

import { setupLogger } from '@abimongo/logger';

const logger = setupLogger({
  level: 'info',
  transporters: [
    {
      write: (msg: string) => {
        // Write to console, file, or any custom destination
        console.log(msg);
      }
    },
    // Add other properties here
  ],
  hooks: {
    onLog: (msg, meta) => {
      // Custom logic after logging
    },
    onError: (err, meta) => {
      // Custom error handling
    }
  },
  enrichMetadata: (meta) => ({
    ...meta,
    timestamp: new Date().toISOString(),
  }),
  excludedSources: ['test'],
});

Logging

logger.info('Application started', { source: 'app' });
logger.error('Something went wrong', { source: 'service', error: new Error('fail') });

Using a Custom Logger

If you already have a logger instance, you can pass it to setupLogger:

const customLogger = {
  info: (msg: string) => { /* ... */ },
  error: (msg: string) => { /* ... */ },
};

const logger = setupLogger({ logger: customLogger });

If you are implementing ( logger ) without using the above setup yourself then follow below steps.

🔥 Advanced Logger Usage (@@abimongo/logger)

The logger is a pluggable, buffered, rolling log system that supports:

  • ✅ JSON or text formatting
  • ✅ Daily file rotation with compression
  • ✅ Multi-tenant routing
  • ✅ Redis real-time log streaming
  • ✅ Metrics tracking

Install Redis for full features

npm install redis      # windows
brew install redis     # macOS
sudo apt install redis # Linux

Usage

import { logger } from '@abimongo/logger';

await logger.log('User created', 'info', { tenantId: 'org-123' });

Metrics

logger.getMetrics(); // { totalLogs, flushedBuffers, logsPerMinute }

Flush & CLose

await logger.flushAll();
await logger.close();

CLI Tools

npm run logger:tail      # Tail logs in terminal (from Redis)
npm run logger:flush     # Flush buffered logs
npm run logger:metrics   # View internal metrics

Real-time Dashboard

npm run start
# Visit /log-dashboard

This page connects to a WebSocket server that listens to logs:* Redis channels.


Development

Running Locally with Docker

A docker-compose.yml is provided for local development:

docker-compose up

This will mount your code, install dependencies, build the library, and keep the container running for development and testing.

Scripts

  • npm run build – Build the library
  • npm test – Run tests
  • npm run lint – Lint the codebase

Publishing

This library is published to npm via GitHub Actions when a new version tag (v*.*.*) is pushed to the main or master branch.


Extending the Library

The abimongo_logger library is designed to be extended. Future utilities can be added under thesrc/` directory and exported via the main entry point.


License

ISC


Maintainers


Contributing

Contributions are welcome! Please open issues or submit pull requests for new utilities or improvements.