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

avlogs

v1.0.7

Published

A lightweight logging library with log rotation and structured logging

Downloads

22

Readme

avlogs

A simple and configurable logging utility for Node.js applications. It supports different log levels, log rotation based on size or time, and configurable log file organization.

Features

  • Supports log levels: debug, info, warn, and error.
  • Logs can be written to different files based on severity or combined into one file.
  • Log rotation strategies: by size, daily, weekly, or monthly.
  • Configurations are loaded from a .env file in the root directory.
  • Logs include timestamps and the package name.
  • Option to log messages to the console.

Installation

npm install avlogs

Configuration

Create a .env file in the root directory of your project with the following variables:

# Logging level: debug, info, warn, error
LOG_LEVEL=debug

# Directory where logs will be stored
LOG_DIR=logs

# Separate logs: Errors & Warnings in one file, Info & Debug in another
LOG_FILE_ERROR_WARN=errors.log
LOG_FILE_INFO_DEBUG=info_debug.log

# Combined log file (for all logs together)
LOG_FILE_ALL=combined.log

# Log rotation strategy: "size", "daily", "weekly", "monthly"
LOG_ROTATION=daily

# Maximum file size before rotation (in bytes)
LOG_MAX_SIZE=1048576  # 1MB

# Log to console? (true/false)
LOG_CONSOLE=true

# Log file combination mode:
# "all" = all logs in one file
# "error_warn" = errors & warnings in one file, info & debug in another
LOG_COMBINATION=error_warn

Usage

Importing and Using AVlogs

require("dotenv").config();
const LogRecorder = require("./avlogs");

const logger = new Avlogs();

logger.info("Application started successfully");
logger.debug("Debugging mode active");
logger.warn("Low memory warning");
logger.error("Unhandled exception occurred");

Running the sample test script

Sample test script inside _test_/test.js:

require("dotenv").config();
const LogRecorder = require("../avlogs");

const logger = new Avlogs();

logger.info("Application started successfully");
logger.debug("Debugging mode active");
logger.warn("Low memory warning");
logger.error("Unhandled exception occurred");

Run sample test script:

node test

Log File Organization

Depending on the .env configuration:

  • All logs in one file: Set LOG_COMBINATION=all, logs are written to combined.log.
  • Separate logs for errors/warnings and info/debug: Set LOG_COMBINATION=error_warn, logs are written to errors.log and info_debug.log.

License

This project is open-source and available under the MIT license.