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

loggical

v1.0.1

Published

Universal logging library with progressive complexity - start simple, add power when needed. Works everywhere: Node.js and browser, with beautiful formatting that scales from zero-config to enterprise-grade logging.

Downloads

11

Readme

🚀 Loggical

npm version npm downloads License: MIT TypeScript Documentation

Universal logging library with progressive complexity - start simple, add power when needed.

Works everywhere: Node.js and browser, with beautiful formatting that scales from zero-config to enterprise-grade logging.

📚 Full DocumentationAPI ReferenceExamples

✨ Key Features

  • 🌍 Universal: Works in Node.js and browser environments
  • 🎨 Beautiful Output: Smart formatting with colors, symbols, and syntax highlighting
  • 🔌 Modular: Plugin architecture keeps core lightweight (~120KB compressed)
  • 🔒 Secure: Automatic redaction of passwords, tokens, API keys, credit cards
  • Fast: Zero-config presets get you started instantly
  • 📦 Transports: Console, File, and WebSocket (plugin) support
  • 🎯 Type-Safe: Full TypeScript support with comprehensive types
  • 🔧 Flexible: 15+ configuration options when you need fine control

📦 Installation

# Using npm
npm install loggical

# Using pnpm (recommended)
pnpm add loggical

# Using yarn
yarn add loggical

🚀 Quick Start

Zero Configuration (Recommended)

Choose a pre-configured logger and start immediately:

import { compactLogger } from "loggical";

compactLogger.info("Task completed", { status: "success", duration: 150 });
// Output: 14:32:18.456 ℹ️ Task completed { status: "success", duration: 150ms }

Available Presets

import {
  compactLogger,  // 📦 Space-efficient with symbols
  readableLogger, // 🌈 Enhanced for development
  serverLogger,   // 🚀 Production-optimized
  logger,         // ⚖️ Standard (balanced)
} from "loggical";

// Use the one that fits your needs
compactLogger.info("Compact output");
readableLogger.debug("Readable output with enhanced colors");
serverLogger.warn("Production-ready output");

Light Customization

Use presets with minimal overrides:

import { Logger, LogLevel } from "loggical";

const apiLogger = new Logger({
  preset: "server",       // Use server preset as base
  prefix: "API",          // Add prefix
  minLevel: LogLevel.WARN // Override log level
});

apiLogger.warn("High memory usage", { usage: 85.7, threshold: 80 });
// Output: 14:32:18.456 ⚠️ [API] High memory usage { usage: 85.7%, threshold: 80% }

Context Management

Attach persistent context to loggers:

// Request-scoped logging with immutable context
const requestLogger = logger.withContext({
  requestId: "req-12345",
  userId: "user-67890"
});

requestLogger.info("Processing request");
// Output includes context in every log

requestLogger.error("Request failed", { error: "Timeout" });
// Context automatically included

📊 Log Levels

Six comprehensive log levels with symbols:

logger.debug("Debug message");      // 🔍 Debug message
logger.info("Info message");        // ℹ️ Info message
logger.warn("Warning message");     // ⚠️ Warning message
logger.error("Error message");      // ❌ Error message
logger.highlight("Important!");     // 🔦 Important!
logger.fatal("Critical error");     // 💀 Critical error (can exit process)

🔒 Automatic Security

Built-in redaction of sensitive data:

logger.info("User login", {
  email: "[email protected]",
  password: "secret123",        // Automatically redacted: password: '***'
  token: "Bearer abc123",       // Automatically redacted: token: '***'
  apiKey: "key_abc123",         // Automatically redacted: apiKey: '***'
  creditCard: "4111-1111-1111-1111" // Masked: '****-****-****-****'
});

🚢 Transport System

Send logs to multiple destinations:

import { Logger, ConsoleTransport, FileTransport } from "loggical";

const prodLogger = new Logger({
  transports: [
    new ConsoleTransport({ colors: false }),
    new FileTransport({
      filename: "/var/log/app.log",
      maxSize: 10 * 1024 * 1024, // 10MB
      maxFiles: 5,
      append: true
    })
  ]
});

WebSocket Transport (Plugin)

Real-time log streaming available as a plugin:

npm install @loggical/websocket-plugin
import { Logger } from "loggical";
import { WebSocketPlugin } from "@loggical/websocket-plugin";

const devLogger = new Logger({
  plugins: [
    new WebSocketPlugin({
      url: "ws://localhost:3001/dev-logs",
      reconnect: true,
      bufferSize: 50
    })
  ]
});

🔌 Plugin System

Keep your bundle small - use plugins for advanced features:

| Plugin | Purpose | Installation | |--------|---------|--------------| | @loggical/namespace-plugin | Hierarchical namespace filtering | npm install @loggical/namespace-plugin | | @loggical/websocket-plugin | Real-time log streaming | npm install @loggical/websocket-plugin | | @loggical/advanced-formatting-plugin | Enhanced formatting options | npm install @loggical/advanced-formatting-plugin | | @loggical/advanced-redaction-plugin | Advanced redaction patterns | npm install @loggical/advanced-redaction-plugin |

⚙️ Environment Configuration

Control logger behavior via environment variables:

# Node.js
export LOGGER_LEVEL=debug
export LOGGER_FORMAT=compact        # or readable, server
export LOGGER_COLORS=true
export LOGGER_TIMESTAMPS=true
export LOGGER_REDACTION=true
export LOGGER_NAMESPACES="app:*:debug,api:*:info"

# Browser: URL parameters or localStorage
# ?logger_level=debug&logger_format=compact

📖 Full Documentation

This README covers the essentials. For comprehensive documentation, visit:

🎯 Why Loggical?

Progressive Complexity

  • 80% of users: Zero-config presets work instantly
  • 15% of users: Light customization with presets + overrides
  • 5% of users: Full control with 15+ configuration options

Visual Excellence

Before (Standard):

2025-06-24T14:32:18.456Z INFO [TASK-EXECUTION-ENGINE] Task completed {
  "executionId": "c97896a8-af4f-4bc6-97fc-6bc851ad573c",
  "duration": 1250,
  "status": "success"
}

After (Loggical):

14:32:18.456 ℹ️ [TASK-ENG] Task completed { executionId: "c97896a8...", duration: 1250ms, status: "success" }

Benefits:

  • 🎯 70% less vertical space
  • 🚀 Faster scanning with symbols and colors
  • 🔍 Smart truncation preserves important info
  • ⚡ Enhanced syntax highlighting for UUIDs, URLs, durations

🌐 Universal Compatibility

Works seamlessly in both environments:

// Node.js
import { serverLogger } from "loggical";
const logger = serverLogger.withPrefix("API");

// Browser
import { compactLogger } from "loggical";
compactLogger.info("Browser logging works!", { userAgent: navigator.userAgent });

🛠️ Advanced Usage

For advanced scenarios, use the full configuration:

import { Logger, ColorLevel, LogLevel } from "loggical";

const customLogger = new Logger({
  // Identity & Organization
  prefix: "API",
  namespace: "app:api",
  
  // Output Control
  minLevel: LogLevel.DEBUG,
  colorLevel: ColorLevel.ENHANCED,
  timestamped: true,
  
  // Formatting
  compactObjects: true,
  shortTimestamp: true,
  useSymbols: true,
  maxValueLength: 50,
  
  // Advanced
  abbreviatePrefixes: true,
  relativeTimestamps: true,
  showSeparators: true,
  
  // Security
  redaction: true,
  fatalExitsProcess: false
});

See the full API documentation for all options.

📚 Examples

Check out the examples/ directory:

# Build the package first
pnpm run build

# Run Node.js example
node examples/node-example.js

# Start browser example server
node examples/serve.js
# Then open http://localhost:3000

🤝 Contributing

Contributions are welcome! Please see CONTRIBUTING.md for details.

📄 License

MIT © Ilan Cohen


Made with ❤️ for developers who care about beautiful, functional logging.