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

andb-logger

v1.0.3

Published

A lightweight Node.js logging utility with color support, customizable icon themes, time formatting, and file logging capabilities

Downloads

12

Readme

andb-logger - Simple Logger

A lightweight Node.js logging utility with color, icons support, time formatting, file logging capabilities, and customizable icon themes.

Features

  • 🎨 Color-coded logs for different log levels
  • Automatic timestamp with GMT+7 timezone by default
  • 📁 File logging with automatic directory creation
  • 🔧 Development mode filtering
  • 🏗️ Singleton pattern for consistent logging across your app
  • 🎭 10 Icon themes for visual customization

Installation

npm install andb-logger

Quick Start

const logger = require('andb-logger').getInstance({
  mode: 'development',
  dirpath: __dirname,
  logName: 'MYAPP',
  theme: 'emoji'  // Choose your icon theme
});

logger.info('Server started on port 3000');
logger.error('Database connection failed');
logger.warn('Deprecated API called');
logger.dev('Debug info - only shown in dev mode');

Icon Themes

AndbLogger comes with 10 pre-built icon themes to make your logs more visual and intuitive:

Available Themes

Classic Theme

Classic Theme Traditional logging icons - clean and professional

Emoji Theme

Emoji Theme Expressive emoji icons - colorful and fun

Symbols Theme

Symbols Theme Simple ASCII symbols - lightweight and universal

Faces Theme

Faces Theme Expressive face emojis - emotional and relatable

Arrow Theme

Arrow Theme Directional arrow icons - modern and sleek

Other themes include:

  • Circles - Circular indicators (minimal and clean)
  • Squares - Square block icons (geometric and structured)
  • Tech - Technology-focused icons (perfect for dev environments)
  • Nature - Natural element icons (organic and calming)
  • Minimal - Single letter indicators (ultra-minimal and fast)

Theme Usage

Set Theme on Initialization

const logger = require('andb-logger').getInstance({
  theme: 'tech'  // Use tech theme
});

Change Theme Dynamically

logger.setTheme('emoji');  // Switch to emoji theme
logger.setTheme('minimal'); // Switch to minimal theme

Theme Examples

Classic Theme (Default):

 ℹ️  MYAPP-INFO - 20/01/2024 10:31:08 > Server started
 ❌ MYAPP-ERROR - 20/01/2024 10:31:08 > Connection failed
 ⚠️  MYAPP-WARNING - 20/01/2024 10:31:08 > Deprecated API
 🔧 MYAPP-DEV - 20/01/2024 10:31:08 > Debug info

Tech Theme:

 💻 MYAPP-INFO - 20/01/2024 10:31:08 > Server started
 🔥 MYAPP-ERROR - 20/01/2024 10:31:08 > Connection failed
 ⚡ MYAPP-WARNING - 20/01/2024 10:31:08 > Deprecated API
 🔧 MYAPP-DEV - 20/01/2024 10:31:08 > Debug info

Minimal Theme:

 i MYAPP-INFO - 20/01/2024 10:31:08 > Server started
 e MYAPP-ERROR - 20/01/2024 10:31:08 > Connection failed
 w MYAPP-WARNING - 20/01/2024 10:31:08 > Deprecated API
 d MYAPP-DEV - 20/01/2024 10:31:08 > Debug info

API Reference

Configuration

const logger = require('andb-logger').getInstance({
  mode: 'production',        // 'production' | 'development' | 'dev'
  dirpath: __dirname,        // Directory for log files
  logName: 'logger',         // Logger name prefix
  theme: 'classic'           // Icon theme (default: 'classic')
});

Log Methods

logger.info(...args)

Log info level messages (cyan color)

logger.info('User logged in', { userId: 123 });
// logger-INFO - 20/01/2024 10:31:08 > User logged in { userId: 123 }

logger.error(...args)

Log error level messages (red color)

logger.error('Database connection failed', error);
// logger-ERROR - 20/01/2024 10:31:08 > Database connection failed Error: ...

logger.warn(...args)

Log warning level messages (yellow color)

logger.warn('Deprecated method called');
// logger-WARNING - 20/01/2024 10:31:08 > Deprecated method called

logger.dev(...args)

Log development messages (magenta color) - only shown in development mode

logger.dev('Debug info', { requestId: 'abc123' });
// logger-DEV - 20/01/2024 10:31:08 > Debug info { requestId: 'abc123' }

logger.setTheme(theme)

Change the icon theme dynamically

logger.setTheme('emoji');  // Switch to emoji theme
logger.setTheme('tech');   // Switch to tech theme

logger.write(text, filename)

Write log to file

logger.write('Custom log message', 'api');
// Creates: logs/api-DESKTOP-F2RK900-20-1-2024.log

Parameters:

  • text (string): Text to write
  • filename (string, optional): File name prefix (default: 'combined')

Examples

Basic Usage with Theme

const logger = require('andb-logger').getInstance({
  theme: 'faces'  // Use expressive face icons
});

logger.info('Application started');  // 😊
logger.error('Something went wrong'); // 😱
logger.warn('This feature is deprecated'); // 😰
logger.dev('Debug information'); // 🤔

Theme Switching

const logger = require('andb-logger').getInstance();

// Start with classic theme
logger.info('Server starting...');

// Switch to tech theme for development
logger.setTheme('tech');
logger.dev('Debug mode enabled');

// Switch to minimal for production
logger.setTheme('minimal');
logger.info('Server ready');

Environment-Based Themes

const logger = require('andb-logger').getInstance({
  mode: process.env.NODE_ENV,
  theme: process.env.NODE_ENV === 'development' ? 'emoji' : 'minimal'
});

Log File Structure

Log files are created in the logs/ directory with the following naming pattern:

{filename}-{hostname}-{day}-{month}-{year}.log

Example: combined-DESKTOP-F2RK900-20-1-2024.log

Timezone Support

AndbLogger supports flexible timezone configuration to ensure accurate timestamps in your logs. By default, it uses GMT+7, but you can customize it

License

MIT