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

logify-log-js

v1.0.0

Published

A lightweight logger for Node.js

Readme

logify-log-js

A simple and customizable logging utility for Node.js, allowing you to log messages with different levels (info, warn, error, debug) to both the console and a log file. The log messages are formatted with a timestamp for better readability.

Installation

To install the package via npm, run the following command:

npm install logify-log-js

Usage

1. Basic Usage (Log to Console and File)

To use the logger in your project, simply import the logger instance and use it to log messages.

import { logger } from 'logify-log-js';

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

2. Log Levels

This logger supports four log levels: info, warn, error, and debug. Each log level is displayed with a different color in the console for better distinction.

  • info: Blue color in console, logged to the file.
  • warn: Yellow color in console, logged to the file.
  • error: Red color in console, logged to the file.
  • debug: Green color in console, logged to the file.
logger.log('info', 'Informational message');
logger.log('warn', 'Warning message');
logger.log('error', 'Error message');
logger.log('debug', 'Debug message');

3. Custom Log File

By default, the logger writes to a file named logs.txt. You can specify your own log file name when initializing the Logger class.

import { logger } from 'logify-log-js';

const customLogger = new Logger('custom-log.txt');
customLogger.log('info', 'This message will be logged to custom-log.txt');

4. File Log Format

Each log message written to the file will include a timestamp and the log level in the format:

[YYYY-MM-DDTHH:mm:ss.sssZ] [LEVEL] Your message here

Example:

[2025-02-09T12:00:00.000Z] [INFO] This is an info message
[2025-02-09T12:01:00.000Z] [ERROR] This is an error message

Methods

log(level: string, message: string)

Logs a message with a specified log level (info, warn, error, debug). The message will be logged both to the console (with color) and to the log file.

Example usage:

logger.log('info', 'Informational message');
logger.log('warn', 'Warning message');
logger.log('error', 'Error message');
logger.log('debug', 'Debug message');

writeToFile(message: string)

Writes a message to the log file.

formatMessage(level: string, message: string)

Formats the log message with a timestamp and the log level.

License

This project is licensed under the MIT License.

Author

Le Minh Hieu