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

@ad-execute-manager/logger

v2.0.5

Published

A flexible logging utility for JavaScript applications with multiple log levels and customizable prefixes.

Readme

@ad-execute-manager/logger

A flexible logging utility for JavaScript applications with multiple log levels and customizable prefixes.

Installation

npm install @ad-execute-manager/logger

Features

  • Multiple Log Levels: Support for error, warn, info, log, and debug levels
  • Customizable Prefix: Add a prefix to identify the source of logs
  • Log Level Control: Set minimum log level to filter out less important messages
  • Enable/Disable: Toggle logging on and off as needed
  • TypeScript Support: Includes TypeScript type definitions

Usage

Basic Usage

import { Logger } from '@ad-execute-manager/logger';

// Create a logger instance
const logger = new Logger({
  prefix: 'MyApp',
  level: 'info',
  enabled: true
});

// Log messages at different levels
logger.error('Something went wrong');
logger.warn('This is a warning');
logger.info('Application started');
logger.log('Regular message');
logger.debug('Debug information');

Log Level Control

import { Logger } from '@ad-execute-manager/logger';

// Create logger with different levels
const productionLogger = new Logger({
  prefix: 'App',
  level: 'warn' // Only show warn and error messages
});

const developmentLogger = new Logger({
  prefix: 'App',
  level: 'debug' // Show all messages
});

// Change level dynamically
productionLogger.setLevel('info');

Enable/Disable Logging

import { Logger } from '@ad-execute-manager/logger';

const logger = new Logger({ prefix: 'MyApp' });

// Disable logging
logger.disable();
logger.info('This won\'t be logged');

// Enable logging
logger.enable();
logger.info('This will be logged');

// Check if logging is enabled
if (logger.isEnabled()) {
  logger.log('Logging is enabled');
}

Real-world Examples

1. Application Logging

import { Logger } from '@ad-execute-manager/logger';

// Create logger based on environment
const logger = new Logger({
  prefix: 'MyApp',
  level: process.env.NODE_ENV === 'production' ? 'info' : 'debug'
});

// Log application startup
logger.info('Application started');

// Log errors
function handleError(error) {
  logger.error('Error occurred:', error);
  // Error handling logic
}

// Log debug information
function processData(data) {
  logger.debug('Processing data:', data);
  // Processing logic
  logger.info('Data processed successfully');
}

2. Module-specific Logging

import { Logger } from '@ad-execute-manager/logger';

// Create logger for different modules
const authLogger = new Logger({ prefix: 'AuthModule' });
const apiLogger = new Logger({ prefix: 'APIModule' });
const dbLogger = new Logger({ prefix: 'DBModule' });

// Use in different modules
function login(user) {
  authLogger.info('User login attempt:', user.username);
  // Login logic
}

function fetchData() {
  apiLogger.debug('Fetching data from API');
  // API call
  apiLogger.info('Data fetched successfully');
}

function saveData(data) {
  dbLogger.debug('Saving data to database');
  // Database operation
  dbLogger.info('Data saved successfully');
}

API

Constructor

new Logger(options)
  • options (Object): Configuration options
    • prefix (String): Log prefix, defaults to 'Logger'
    • level (String): Log level, options: 'error', 'warn', 'info', 'log', 'debug', defaults to 'log'
    • enabled (Boolean): Whether logging is enabled, defaults to true

Methods

  • enable(): Enable logging
  • disable(): Disable logging
  • isEnabled(): Return whether logging is enabled
  • setLevel(level): Set log level
    • level (String): Log level
  • error(message, ...args): Output error log
  • warn(message, ...args): Output warning log
  • info(message, ...args): Output info log
  • log(message, ...args): Output regular log
  • debug(message, ...args): Output debug log

Log Levels

| Level | Description | Methods | |---------|------------------------------|--------------------| | error | Error messages | logger.error() | | warn | Warning messages | logger.warn() | | info | Information messages | logger.info() | | log | Regular messages | logger.log() | | debug | Debug information | logger.debug() |

The log level is hierarchical, meaning if you set the level to 'info', it will show info, warn, and error messages, but not log or debug messages.

License

MIT