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

logwizard

v2.0.2

Published

A lightweight Node.js logging utility with file logging, daily log rotation, console output, and customizable separators.

Readme

Logger

A simple logging utility for Node.js that logs messages to a specified file and optionally to the console. The logger supports different log levels, including debug, info, warn, and error.

Features

  • Log messages to a file with a timestamp.
  • Support for multiple log levels: debug, info, warn, and error.
  • Optionally log messages to the console.
  • Customizable log message separator.
  • Automatically create the log directory if it does not exist.

Installation

To use the Logger class, you can need to install it via npm.

npm install logwizard

Usage

Here’s an example of how to use the Logger.:

const Logger = require('logwizard'); 

// Logs will be stored in "logs/access/YYYY-MM-DD.log"
const logger = new Logger('logs/access', '|', true, true); // Log to 'logs/app.log', use '|' as separator, log to console

logger.debug('This is a debug message');
logger.info('This is an info message');
logger.warn('This is a warning message');
logger.error('This is an error message');

Constructor Parameters

The Logger class constructor accepts the following parameters:

  • filePath (String):

    • Description: The path to the log file where messages will be recorded.
    • Example: 'logs/app.log'.
  • separator (String, optional):

    • Description: The character used to separate log message components. Defaults to |.
    • Example: '/'.
  • logToConsole (Boolean, optional):

    • Description: If true, log messages will also be printed to the console. Defaults to false.
    • Example: true.
  • logRotation (Boolean, optional):

    • Description: If true, logs are rotated daily into files named YYYY-MM-DD.log. If false it will create file name as filePath parameter. Defaults to false.
    • Example: true.

Method Parameters

debug(message)

  • message (String | Array):
    • Description: The message or array of messages to log as a debug entry.

info(message)

  • message (String | Array):
    • Description: The message or array of messages to log as an info entry.

warn(message)

  • message (String | Array):
    • Description: The message or array of messages to log as a warning entry.

error(message)

  • message (String | Array):
    • Description: The message or array of messages to log as an error entry.

Methods

debug(message)

  • Description: Logs a debug message to the file (and optionally to the console).
  • Parameters:
    • message (String | Array): The message or array of messages to log as a debug entry.
  • Example:
    logger.debug('This is a debug message');
    

info(message)

  • Description: Logs an informational message to the file (and optionally to the console).
  • Parameters:
    • message (String | Array): The message or array of messages to log as a debug entry.
  • Example:
    logger.info('This is a info message');
    

warn(message)

  • Description: Logs a warning message to the file (and optionally to the console).
  • Parameters:
    • message (String | Array): The message or array of messages to log as a warning entry.
  • Example:
    logger.warn('This is a warn message');
    

error(message)

  • Description: Logs a error message to the file (and optionally to the console).
  • Parameters:
    • message (String | Array): The message or array of messages to log as a error entry.
  • Example:
    logger.error('This is a warn message');
    
    

Notes

This section can clarify important behaviors and usage notes for the logger.

- The logger will create the specified log directory if it does not already exist, but make sure user executing program has permission to create directory. 
- Log messages can be passed as a string or an array of strings. If an array is provided, the logger will join the elements using the specified separator.
- The log file will be created if it doesn't exist, and new entries will be appended to the file.
- The log messages include a timestamp in ISO format, making it easy to track when each log entry was created.

License

This format makes it clear what parameters the user can expect and how to use them effectively!