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

logit-pro

v1.0.5

Published

A flexible logging package that supports level-based logging (debug, info, warn, error) and automatic log rotation (daily, weekly, monthly, yearly). Easily configure log levels and rotation to suit your needs.

Readme

logit-pro

npm version

logit-pro is a flexible and powerful logging package for Node.js, providing level-based logging and automatic log rotation. It allows you to manage logs effectively with configurable log levels, customizable file names, and support for daily, weekly, monthly, or yearly log rotation.

Features

  • Level-based Logging: Supports debug, info, warn, and error levels.
  • Time-based Log Rotation: Rotate logs on a daily, weekly, monthly, or yearly basis.
  • Customizable Log Settings: Easily configure the log directory, file name, log level, and rotation type.
  • Automatic Log File Handling: Creates new log files if they don't exist and handles log file rotation.

Installation

To use logit-pro, ensure you have Node.js installed.

Install the package via npm:

npm install logit-pro

Usage

Basic Logging

You can log messages at different levels using the following methods:

const logIt = require('logit-pro');

// Log an info message
logIt.info('This is an info message');

// Log a warning message
logIt.warn('This is a warning message');

// Log an error message
logIt.error('This is an error message');

// Log a debug message
logIt.debug('This is a debug message');

Configuration

logit-pro allows you to configure the logging behavior. You can set a custom log directory, log level, log file name, and log rotation type.

Here’s an example of how to configure the logger:

const logIt = require('logit-pro');

// Configure custom settings with dynamic log file name
logIt.configure({
  logDirectory: './mylogs',  // Custom log directory
  logLevel: 'error',         // Log level (default: 'debug')
  rotateBy: 'daily',         // Rotation type ('daily', 'weekly', 'monthly', 'yearly')
  fileName: 'myapp.log',     // Custom log file name
});

// Log messages
logIt.info('This is an info message');
logIt.warn('This is a warning');
logIt.error('An error occurred');
logIt.debug('Debugging information');

Log Level Configuration

By default, the log level is set to debug, which means all log levels (debug, info, warn, error) will be logged. You can change the log level to control which messages are logged.

Example: To log only error messages, configure as follows:

logIt.configure({ logLevel: 'error' });  // Logs only errors

Log Rotation

logit-pro supports log rotation based on time intervals. The rotation options are:

  • daily
  • weekly
  • monthly
  • yearly

You can specify the rotation type in the configuration.

For example, to rotate logs on a daily basis:

logIt.configure({ rotateBy: 'daily' });

Log File Naming

The log file name will be generated dynamically based on the configured rotation type. For instance:

  • Daily rotation: myapp-daily-2025-07-17.log
  • Weekly rotation: myapp-weekly-2025-07-12.log
  • Monthly rotation: myapp-monthly-2025-07.log
  • Yearly rotation: myapp-yearly-2025.log

Example Test Code

Here's an example of how to use logit-pro in your project:

const logIt = require('logit-pro');

// Configure custom settings with dynamic log file name
logIt.configure({
  logDirectory: './mylogs',  // Custom log directory
  logLevel: 'error',         // Log only errors and above
  rotateBy: 'daily',         // Rotation type ('daily', 'weekly', 'monthly', 'yearly')
  fileName: 'myapp.log',     // Custom log file name
});

// Log messages at different levels
logIt.info('This is an info message');
logIt.warn('This is a warning');
logIt.error('An error occurred');
logIt.debug('Debugging information');

// Logs will be saved to ./mylogs/myapp-2025-07-17.log, and rotated based on time.

Log Format

Logs will be written in the following format:

YYYY-MM-DD HH:mm:ss [LEVEL] Message

Example:

2025-07-17 14:25:30 [INFO] Application started
2025-07-17 14:26:10 [ERROR] An error occurred

Methods

  • logIt.info(message): Logs an info message.
  • logIt.warn(message): Logs a warning message.
  • logIt.error(message): Logs an error message.
  • logIt.debug(message): Logs a debug message.
  • logIt.configure(options): Customizes the logging configuration (log level, directory, file name, rotation type).

Log Rotation

The log files are rotated according to the rotateBy configuration:

  • Daily rotation: myapp-daily-2025-07-17.log
  • Weekly rotation: myapp-weekly-2025-07-12.log
  • Monthly rotation: myapp-monthly-2025-07.log
  • Yearly rotation: myapp-yearly-2025.log

Log files are automatically renamed when a new rotation period begins, and logs are appended to the file.

License

This package is licensed under the MIT License.


For any issues or contributions, please visit the repository: