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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@platek549/logger

v0.0.3

Published

A custom logger package for logging messages in various formats.

Readme

Logger

A customizable and easy-to-use logging library for Node.js. This logger supports multiple log levels, custom colors, file logging, and even formatting tables for better visualization. You can tailor its behavior to fit your needs, such as muting logs or adjusting the log level dynamically.

Features

  • Supports multiple log levels: LOG, INFO, WARN, ERROR, DEBUG.
  • Customizable colors for different log levels and table headers/cells.
  • Logs are saved to files, with separate logs for different levels.
  • Option to mute logs or adjust the minimum log level.
  • Formats tables for better readability when logging structured data.
  • Compatible with both simple console logs and file-based logging.

Installation

To install the package, use the following command:

npm install @platek549/logger

Usage

Basic Example

import { Logger } from '@platek549/logger';

// Create a new logger instance with custom options
const logger = new Logger({
    prefix: 'MyApp',
    logLevel: 'DEBUG', // Set the minimum log level
    colors: {
        log: '#00FF00',
        info: '#0000FF',
        warn: '#FFFF00',
        error: '#FF0000',
        tableHeader: '#FFFFFF',
        tableCell: '#FF6347', // Tomato color for table cells
    },
    paths: {
        all: './logs/all.log',
        error: './logs/error.log',
        warn: './logs/warn.log',
        info: './logs/info.log',
        log: './logs/log.log',
        debug: './logs/debug.log',
    }
});

// Log different types of messages
logger.log('This is a regular log message');
logger.info('This is an info message');
logger.warn('This is a warning');
logger.error('This is an error');
logger.debug('This is a debug message');

// Logging a table
const users = [
    { name: 'John', age: 30 },
    { name: 'Jane', age: 25 }
];

logger.table(users);

Example Output

[2024-11-16T15:56:59.018Z][MyApp - LOG] This is a regular log message
[2024-11-16T15:56:59.018Z][MyApp - INFO] This is an info message
[2024-11-16T15:56:59.018Z][MyApp - WARN] This is a warning
[2024-11-16T15:56:59.018Z][MyApp - ERROR] This is an error
[2024-11-16T15:56:59.018Z][MyApp - DEBUG] This is a debug message

[2024-11-16T15:56:59.018Z][MyApp - INFO] 
╔══════╤═════╗
║ name │ age ║
╟──────┼─────╢
║ John │ 30  ║
╟──────┼─────╢
║ Jane │ 25  ║
╚══════╧═════╝

Changing Log Level

You can change the log level dynamically:

logger.setLogLevel('INFO'); // Only logs messages of INFO level and above

Mute and Unmute Logs

logger.mute();  // Mute all logs
logger.unmute();  // Unmute logs

Customize Colors

logger.updateColors({
    log: '#32CD32', // Lime green for regular logs
    info: '#1E90FF', // Dodger blue for info messages
});

Options

The logger accepts the following configuration options:

{
    prefix: string; // Prefix for the log messages, default is 'Logger'
    logLevel: 'LOG' | 'INFO' | 'WARN' | 'ERROR' | 'DEBUG'; // Minimum log level (default: 'DEBUG')
    colors: {
        log: string; // Color for regular logs (hex format)
        info: string; // Color for info messages (hex format)
        warn: string; // Color for warning messages (hex format)
        error: string; // Color for error messages (hex format)
        tableHeader: string; // Color for table headers (hex format)
        tableCell: string; // Color for table cells (hex format)
    };
    paths: {
        all: string; // Path to save all logs
        error: string; // Path to save error logs
        warn: string; // Path to save warning logs
        info: string; // Path to save info logs
        log: string; // Path to save regular logs
        debug: string; // Path to save debug logs
    };
    muteLogs: boolean; // Whether to mute logs (default: false)
}

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

License

This project is licensed under the MIT License.