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

@aitc/logger

v1.0.0

Published

AITC logging utility with requestId and service name support. Built on winston with customizable transports.

Downloads

16

Readme

@aitc/logger

AITC logging utility with requestId and service name support. Built on winston with customizable transports.

Installation

npm install @aitc/logger

Quick Start

const { createLogger } = require("@aitc/logger");

const logger = createLogger({
  level: process.env.LOG_LEVEL || "info",
  service: "property-service",
  transports: ["console", "file"],
  logDir: __dirname,
});

// Use the logger
logger.info("Application started", { requestId: "abc123" });
logger.error("Something went wrong", { error: error.message, requestId: "abc123" });

Configuration Options

createLogger(options)

Creates a logger instance with the following options:

| Option | Type | Default | Description | |--------|------|---------|-------------| | level | string | process.env.LOG_LEVEL \|\| "info" | Log level (info, error, warn, debug) | | service | string | null | Service name to include in logs | | transports | Array | ["console"] | Transport types: "console", "file" | | logDir | string | process.cwd() | Directory for log files (only if file transport enabled) | | errorLogFile | string | "error.log" | Error log filename | | combinedLogFile | string | "combined.log" | Combined log filename |

Usage Examples

Basic Usage (Console Only)

const { createLogger } = require("@aitc/logger");

const logger = createLogger({
  level: "info",
  service: "my-service",
});

logger.info("User logged in", { userId: 123, requestId: "req-456" });
logger.error("Database connection failed", { error: err.message, requestId: "req-456" });

With File Logging

const { createLogger } = require("@aitc/logger");
const path = require("path");

const logger = createLogger({
  level: process.env.LOG_LEVEL || "info",
  service: "property-service",
  transports: ["console", "file"],
  logDir: path.join(__dirname, "logs"),
  errorLogFile: "error.log",
  combinedLogFile: "combined.log",
});

Using Environment Variables

const { createLogger } = require("@aitc/logger");

// LOG_LEVEL is automatically read from process.env
const logger = createLogger({
  service: "auth-service",
  transports: ["console"],
});

Migration from Old Logger

If you're migrating from the old logger that used a config file:

Before:

const logger = require("../utils/logger");
const config = require("../config/config");

After:

const { createLogger } = require("@aitc/logger");
const config = require("../config/config");

const logger = createLogger({
  level: config.log_level || process.env.LOG_LEVEL || "info",
  service: "property-service",
  transports: ["console", "file"],
  logDir: __dirname,
});

API

logger.info(message, meta)

Logs an info message.

Parameters:

  • message (string): Log message
  • meta (object): Metadata object. Special fields:
    • requestId: Request ID to include in log
    • service: Service name (overrides default service)
    • Any other fields will be JSON stringified

logger.error(message, meta)

Logs an error message.

logger.warn(message, meta)

Logs a warning message.

logger.debug(message, meta)

Logs a debug message.

logger.raw

Access to the underlying winston logger instance for advanced usage.

Log Format

Logs are formatted as:

YYYY-MM-DD HH:mm:ss [LEVEL] [service-name] [request-id: requestId] message {metadata}

Example:

2026-01-09 12:30:45 [INFO] [property-service] [request-id: abc123] User logged in {"userId":123}

Environment Variables

  • LOG_LEVEL: Sets the default log level (info, error, warn, debug)

License

ISC

Support

For issues and questions, please contact the AITC development team.