New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@anindividual/logger

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@anindividual/logger

Smart logger with file support, build process integration, and AI-friendly debugging

latest
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

@allan/logger

A smart, production-ready logging system optimized for modern development workflows and AI-assisted debugging.

Features

  • Environment-aware: Different behavior in development and production
  • File-based logging: Automatic log rotation and management
  • Build process integration: Track build steps and errors
  • Log analysis: Identify error patterns and generate reports
  • AI-friendly format: Structured, tagged logs for better debugging with AI tools
  • Notification system: Alerts for critical errors

Installation

npm install @allan/logger

Basic Usage

import Logger from '@allan/logger';

// Basic logging
Logger.log('Application started');
Logger.debug('INIT', 'Initializing with config:', { port: 3000 });
Logger.warn('Connection timeout, retrying...');
Logger.error('Failed to connect to database', err);

// Critical errors (always logged, even in production)
Logger.critical('DATABASE', 'Connection lost to primary database', error);

Advanced Usage - Build Logging

import { BuildLogger } from '@allan/logger';

async function runBuild() {
  const buildLogger = new BuildLogger('web-app');
  
  try {
    buildLogger.log('WEBPACK', 'Starting compilation');
    // ... build steps ...
    buildLogger.finish(true); // Success
    return true;
  } catch (error) {
    buildLogger.error('BUILD', 'Process failed', error);
    buildLogger.finish(false); // Failed
    return false;
  }
}

Error Analysis

import { LogAnalyzer } from '@allan/logger';

async function analyzeErrors() {
  const analyzer = new LogAnalyzer();
  const patterns = await analyzer.findErrorPatterns(7); // Last 7 days
  const report = await analyzer.generateErrorReport();
  console.log(report);
}

Notification Integration

import { Notifier } from '@allan/logger';

// Configure in your environment variables:
// ENABLE_SLACK_NOTIFICATIONS=true
// ENABLE_EMAIL_NOTIFICATIONS=true
// ERROR_EMAIL_RECIPIENTS=dev@example.com,alerts@example.com

try {
  // Critical operation
} catch (error) {
  await Notifier.notifyCriticalError('PAYMENT', 'Transaction failed', error);
}

AI-Assisted Debugging

When asking AI tools like GitHub Copilot or ChatGPT to help debug, share your logs with proper tags:

[DEBUG] [AUTH]: Login attempt { "username": "user@example.com" }
[ERROR] [AUTH]: Login failed Error: Invalid credentials

The structured format helps AI tools better understand the context and flow of your application.

License

MIT

Keywords

logger

FAQs

Package last updated on 13 May 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts