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

@mks2508/better-logger

v1.2.1

Published

Logger avanzado para consola con estilos CSS, temas adaptativos, badges automáticos, SVG, animaciones, CLI integrado y soporte dual browser/terminal con colores ANSI

Readme

🚀 Better Logger

State-of-the-art console logger with advanced CSS styling, SVG support, animations, and CLI interface

NPM Version Bundle Size TypeScript License

Transform your console logging experience with beautiful styling, professional themes, and advanced features that make debugging and monitoring a visual delight.

✨ Features

  • 🚀 Simplified API - 80% less code for basic use cases
  • 🎨 Smart Presets - Apply beautiful themes in one line: logger.preset('cyberpunk')
  • 🏷️ Auto-Badges - Component and API loggers with automatic tagging
  • 🌗 Adaptive Themes - Automatic light/dark mode detection
  • Context Logging - Temporary scopes that auto-cleanup
  • 🎛️ Toggle Controls - Show/hide elements with simple methods
  • 📊 Data Export - CSV, JSON, XML export with filtering
  • 💻 Interactive CLI - Built-in command interface
  • 🔧 Modular Architecture - Import only what you need
  • 🎯 TypeScript First - Complete type safety and IntelliSense

📦 Installation

Full Package (Recommended)

npm install @mks2508/better-logger

Modular Installation

Choose only the functionality you need:

# Core logging only (~15KB)
npm install @mks2508/better-logger-core

# Add styling capabilities (~12KB)  
npm install @mks2508/better-logger-styling

# Add export handlers (~18KB)
npm install @mks2508/better-logger-exports

📋 View Complete Packages Guide →

🚀 Quick Start

Basic Usage (Zero Configuration)

import logger from '@mks2508/better-logger';

// Works perfectly out-of-the-box with adaptive themes
logger.info('Application started');
logger.success('Database connected');
logger.warn('High memory usage');
logger.error('Connection failed');

One-Line Styling

// Apply beautiful presets instantly
logger.preset('cyberpunk');     // Neon colors, glowing effects
logger.preset('glassmorphism'); // Modern blur effects
logger.preset('minimal');       // Clean and simple
logger.preset('debug');         // Detailed development mode

Toggle Features

// Control visibility with simple methods
logger.hideTimestamp();
logger.showLocation();
logger.hideBadges();

Component & API Logging

// Scoped loggers with auto-badges
const auth = logger.component('UserAuth');
auth.info('Login attempt');     // [COMPONENT] [UserAuth] Login attempt
auth.success('User verified');  // [COMPONENT] [UserAuth] User verified

// API loggers with multiple badges
const api = logger.api('GraphQL').badges(['SLOW', 'CACHE']);
api.warn('Query timeout');      // [API] [SLOW] [CACHE] [GraphQL] Query timeout
api.auth('Invalid token');      // [API] [AUTH] [GraphQL] Invalid token

Smart Context System

const dbLogger = logger.component('Database');

// Context auto-removes after execution
dbLogger.context('Migration').run(() => {
  dbLogger.info('Starting migration');    // [Database:Migration] Starting migration
  dbLogger.success('Tables created');     // [Database:Migration] Tables created
});
// Context automatically cleaned up

Simple Customization

// Minimal configuration for specific needs
logger.customize({
  message: { color: '#007bff', size: '15px' },
  timestamp: { show: false },
  spacing: 'compact'
});

Advanced Styling (Power Users)

import { Logger } from '@mks2508/better-logger';

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

// Beautiful styled logging
logger.info('Application started', { version: '1.0.0' });
logger.success('Database connected successfully');
logger.warn('Memory usage high', { usage: '85%' });
logger.error('API request failed', { status: 500 });

// Performance timing
logger.time('operation');
await performOperation();
logger.timeEnd('operation'); // Shows duration with beautiful styling

🔧 Enhanced CLI Interface

New in v0.1.0-rc.1! Interactive CLI with plugin support and command history:

import { Logger } from '@mks2508/better-logger';

const logger = new Logger();

// Enter interactive mode
logger.executeCommand('/interactive');

// Use enhanced CLI in browser console:
cli('help');             // Show all commands
cli('theme cyberpunk');  // Change theme
cli('history 5');        // View command history  
cli('plugins');          // List loaded plugins

// Create custom plugins
const myPlugin = {
  name: 'analytics',
  commands: [{ 
    name: 'track', 
    execute: (args, logger) => logger.info(`Tracking: ${args}`) 
  }]
};
logger.cliProcessor.registerPlugin(myPlugin);

🔧 Modular Usage

Import only what you need for optimal bundle sizes:

// Core logging only (6KB) - Essential features
import { Logger } from '@mks2508/better-logger/core';

// Styling features (26KB) - Themes, SVG, animations
import { setTheme, logAnimated } from '@mks2508/better-logger/styling';

// Export capabilities (12KB) - Data export, remote logging
import { ExportLogger } from '@mks2508/better-logger/exports';

📊 Bundle Analysis

| Module | Size | Gzipped | Best For | |--------|------|---------|----------| | Core | 6KB | 2KB | Essential logging, Node.js apps | | Styling | 26KB | 5KB | Frontend apps, visual debugging | | Exports | 12KB | 3KB | Production logging, analytics | | Full | 64KB | 13KB | Complete feature set |

📚 Documentation & Learning

📖 Complete Documentation

🎮 Interactive Learning

🏃 Quick Examples

cd examples && npm install
npm run basic        # Learn fundamentals
npm run performance  # Master timing operations
npm run styling      # Explore visual features
npm run export       # Data management

🎨 Visual Showcase

Professional Themes

import { setTheme } from '@mks2508/better-logger/styling';

setTheme('cyberpunk');  // Purple/pink futuristic
setTheme('neon');       // Bright electric colors
setTheme('dark');       // Dark mode optimized

Custom Styling

import { createStyle } from '@mks2508/better-logger/styling';

const customStyle = createStyle()
  .bg('linear-gradient(45deg, #667eea, #764ba2)')
  .color('white')
  .padding('12px 24px')
  .rounded('8px')
  .shadow('0 4px 15px rgba(102, 126, 234, 0.4)')
  .build();

console.log('%c🚀 Beautiful Custom Style!', customStyle);

⚡ Advanced Features

CLI Interface

import { initializeCLI } from '@mks2508/better-logger/cli';
initializeCLI(logger);

// Available in browser console:
// /help /theme /export /clear /status

Performance Monitoring

logger.time('api-request');
const result = await fetch('/api/data');
logger.timeEnd('api-request'); // Automatic duration display

Data Export

import { ExportLogger } from '@mks2508/better-logger/exports';

const logger = new ExportLogger();
const csvData = await logger.exportLogs('csv', {
  filter: { level: 'error' },
  limit: 100
});

🌐 Compatibility

  • All Modern Browsers - Full feature support
  • Node.js - Core features with graceful fallbacks
  • TypeScript - Complete type definitions
  • ESM & CommonJS - Both module systems supported

🔗 Resources

🤝 Contributing

Contributions welcome! See our Contributing Guide for details.

📄 License

MIT License - see LICENSE for details.


Made with ❤️ by MKS2508