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

aol-logger

v1.0.42

Published

A configurable logger package with audit support using winston

Readme

aol-logger

A lightweight, enterprise-ready logger. Supports structured logs for both application and audit events, and integrates smoothly with PM2 + ELK stack environments.


📦 Installation

npm install aol-logger

🚀 Getting Started

Step 1: Initialize the Logger

In your service, create a logger.ts file to initialize and export the loggers:

// logger.ts
import { initLogger } from "aol-logger";

export const { logger, auditLogger } = initLogger("bx-be", "info");

Parameters:

  • service_name: Name of the service (bx-be, caps-be, etc.)
  • minLogLevel: Log level threshold (debug, info, warn, error)

📘 Usage

Import and use the logger and auditLogger as shown below:

// someService.ts
import { logger, auditLogger } from "./logger";

// General logs
logger.debug("Debugging mode active");
logger.info("User fetched successfully");
logger.warn("Disk space running low");
logger.error("Database connection failed");

// Audit logs
auditLogger.info("audit log", {
  user_id: 1,
  event_action: "create",
  event_type: "course",
  event_id: 123,
  location_id: 1 
});

🔍 Audit Log Fields Explained

Audit logs are critical for maintaining traceability of important actions in your system. Here's what each field means in the auditLogger payload:

🧑 user_id

  • Type: number | string
  • Description: Unique identifier of the user who performed the action.
  • Purpose: Allows identifying which user is responsible for an operation.

🛠️ event_action

  • Type: string
  • Examples: "create", "update", "delete", "view", "login", "logout"
  • Description: Describes the type of action performed.
  • Purpose: Classifies the user’s operation for better auditing.

🧱 event_type

  • Type: string
  • Examples: "course", "user", "payment", "settings"
  • Description: The domain/entity that the action is related to.
  • Purpose: Helps segment audit logs by entity or feature.

🆔 event_id

  • Type: number | string
  • Description: Identifier of the affected entity (e.g., course ID).
  • Purpose: Gives context about the specific resource involved in the action.

🆔 location_id

  • Type: number | string
  • Description: Identifier for the location, tenant, or region where the action occurred.
  • Purpose: Useful for filtering logs in multi-tenant or multi-region applications.
  • Examples: In PF, use tenant_id, In TPTM, use region_id

✅ Example

auditLogger.info("audit log", {
  user_id: 1,
  event_action: "create",
  event_type: "course",
  event_id: 123,
  location_id: 1 
});

📘 This means: "User 1 has created a course in location-1 with ID 123."



🔐 Best Practices

  • Initialize logger and auditLogger once per service.
  • Use audit logs for all critical operations that affect user data or system state.
  • Set minLogLevel using environment variables for different environments (dev, staging, prod).

🛠️ Supported Environments

  • Node.js (Express, NestJS, etc.)
  • Deno (via compatibility layer)
  • Compatible with PM2, Docker, ELK, and more

📄 License

MIT © Art of Living Digital