WG's Log Engine is the ultimate logging solution for Node.js developers - a lightweight, battle-tested utility specifically engineered for Discord bots, Telegram bots, web servers, APIs, and server-side applications. Born from real-world development challenges and proven in production environments like the Unthread Discord Bot, Log Engine delivers enterprise-grade logging with zero complexity and beautiful color-coded console output.
Stop wrestling with logging configurations and start building amazing applications. Whether you're creating the next viral Discord community bot, building high-performance APIs, developing microservices, or deploying production servers, Log Engine provides intelligent terminal-based logging with vibrant colors that scales with your application's growth - from your first "Hello World" to handling millions of requests across distributed systems.
Picture this: It's 2 AM, your server is crashing in production, and you're staring at a terminal filled with thousands of debug messages mixed with critical errors. Sound familiar? I've been there too many times. I created Log Engine because every developer deserves to sleep peacefully, knowing their logs are working intelligently in the background.
Log Engine transforms your development experience from chaotic debugging sessions into confident, data-driven problem solving. No more guessing what went wrong, no more drowning in irrelevant logs, no more manual configuration headaches. Just clear, contextual information exactly when and where you need it. Because great applications deserve great logging, and great developers deserve tools that just work.
- Lightweight & Fast: Minimal overhead with maximum performance - designed to enhance your application, not slow it down.
- No Learning Curve: Dead simple API that you can master in seconds. No extensive documentation, complex configurations, or setup required - Log Engine works instantly.
- Colorized Console Output: Beautiful ANSI color-coded log levels with intelligent terminal formatting - instantly identify message severity at a glance with color-coded output.
- Multiple Log Modes: Support for DEBUG, INFO, WARN, ERROR, SILENT, OFF, and special LOG levels with smart filtering - just set your mode and let it handle the rest.
- Auto-Configuration: Intelligent environment-based setup using NODE_ENV variables. No config files, initialization scripts, or manual setup - Log Engine works perfectly out of the box.
- Enhanced Formatting: Structured log entries with dual timestamps (ISO + human-readable) and colored level indicators for maximum readability.
- TypeScript Ready: Full TypeScript support with comprehensive type definitions for a seamless development experience.
- Zero Dependencies: No external dependencies for maximum compatibility and security - keeps your bundle clean and your project simple.
- Easy Integration: Simple API that works seamlessly with existing Node.js applications. Just
import
and start logging - no middleware, plugins, or configuration required.
- Log Engine automatically detects your environment using
NODE_ENV
and sets appropriate log levels for optimal performance - When you call logging methods, messages are filtered based on the configured severity level (only messages at or above the set level are displayed)
- Each log message is instantly formatted with precise timestamps in both ISO and human-readable formats
- Messages are output to the console with colorized level indicators and timestamps, making debugging and monitoring effortless - errors show in red, warnings in yellow, info in blue, and debug in purple
- ANSI color codes ensure compatibility across different terminal environments while maintaining beautiful, readable output
Ready to streamline your application logging? Get started in seconds with our simple installation!
π Platinum Sponsor |
---|
![]() |
Unthread Streamlined support ticketing for modern teams. |
Open source development is resource-intensive. These sponsored ads help keep Log Engine free and actively maintained while connecting you with tools and services that support open-source development.
Install the package using npm:
npm install @wgtechlabs/log-engine
Or using yarn:
yarn add @wgtechlabs/log-engine
import { LogEngine, LogMode } from '@wgtechlabs/log-engine';
// Basic usage with auto-configuration based on NODE_ENV
LogEngine.debug('This is a debug message');
LogEngine.info('This is an info message');
LogEngine.warn('This is a warning message');
LogEngine.error('This is an error message');
LogEngine.log('This is a critical message that always shows');
Log Engine now uses a modern LogMode system that separates message severity from output control:
import { LogEngine, LogMode } from '@wgtechlabs/log-engine';
// Configure using LogMode (recommended approach)
LogEngine.configure({ mode: LogMode.DEBUG }); // Most verbose
LogEngine.configure({ mode: LogMode.INFO }); // Balanced
LogEngine.configure({ mode: LogMode.WARN }); // Focused
LogEngine.configure({ mode: LogMode.ERROR }); // Minimal
LogEngine.configure({ mode: LogMode.SILENT }); // Critical only
LogEngine.configure({ mode: LogMode.OFF }); // Complete silence
// Environment-based configuration example
const env = process.env.NODE_ENV || 'development';
if (env === 'production') {
LogEngine.configure({ mode: LogMode.INFO });
} else if (env === 'staging') {
LogEngine.configure({ mode: LogMode.WARN });
} else {
LogEngine.configure({ mode: LogMode.DEBUG });
}
// Now use Log Engine - only messages appropriate for the mode will be shown
LogEngine.debug('This will only show in DEBUG mode');
LogEngine.info('General information');
LogEngine.warn('Warning message');
LogEngine.error('Error message');
LogEngine.log('Critical message that always shows');
For backwards compatibility, the old LogLevel
API is still supported:
import { LogEngine, LogLevel } from '@wgtechlabs/log-engine';
// Legacy configuration (still works but LogMode is recommended)
LogEngine.configure({ level: LogLevel.DEBUG });
LogEngine.configure({ level: LogLevel.INFO });
LogEngine.configure({ level: LogLevel.WARN });
LogEngine.configure({ level: LogLevel.ERROR });
Version 1.2.0+ introduces the new LogMode system for better separation of concerns. Here's how to migrate:
// OLD (v1.1.0 and earlier) - still works but deprecated
import { LogEngine, LogLevel } from '@wgtechlabs/log-engine';
LogEngine.configure({ level: LogLevel.DEBUG });
// NEW (v1.2.0+) - recommended approach
import { LogEngine, LogMode } from '@wgtechlabs/log-engine';
LogEngine.configure({ mode: LogMode.DEBUG });
Key Benefits of LogMode:
- Clearer API: Separates message severity (
LogLevel
) from output control (LogMode
) - Better Environment Defaults:
developmentβDEBUG
,stagingβWARN
,testβERROR
- Future-Proof: New features will use the LogMode system
- 100% Backwards Compatible: Existing code continues to work unchanged
Log Engine now features beautiful, color-coded console output that makes debugging and monitoring a breeze:
import { LogEngine } from '@wgtechlabs/log-engine';
// Each log level gets its own distinct color for instant recognition
LogEngine.debug('π Debugging user authentication flow'); // Purple/Magenta
LogEngine.info('βΉοΈ User successfully logged in'); // Blue
LogEngine.warn('β οΈ API rate limit at 80% capacity'); // Yellow
LogEngine.error('β Database connection timeout'); // Red
LogEngine.log('π Application started successfully'); // Green
Why Colors Matter:
- Instant Recognition: Quickly spot errors, warnings, and debug info without reading every line
- Better Debugging: Visually separate different types of messages during development
- Production Monitoring: Easily scan logs for critical issues in terminal environments
- Enhanced Readability: Color-coded timestamps and level indicators reduce eye strain
Log Engine uses a LogMode system that controls output verbosity and filtering:
LogMode.DEBUG
(0) - Most verbose: shows DEBUG, INFO, WARN, ERROR, LOG messagesLogMode.INFO
(1) - Balanced: shows INFO, WARN, ERROR, LOG messagesLogMode.WARN
(2) - Focused: shows WARN, ERROR, LOG messagesLogMode.ERROR
(3) - Minimal: shows ERROR, LOG messagesLogMode.SILENT
(4) - Critical only: shows LOG messages onlyLogMode.OFF
(5) - Complete silence: shows no messages at all
Individual log messages have severity levels that determine their importance:
LogLevel.DEBUG
(0) - Detailed information for debuggingLogLevel.INFO
(1) - General informationLogLevel.WARN
(2) - Warning messagesLogLevel.ERROR
(3) - Error messagesLogLevel.LOG
(99) - Critical messages that always show (except when OFF mode is set)
Log Engine automatically configures itself based on the NODE_ENV
environment variable:
development
βLogMode.DEBUG
(most verbose)production
βLogMode.INFO
(balanced)staging
βLogMode.WARN
(focused)test
βLogMode.ERROR
(minimal)default
βLogMode.INFO
(balanced)
The LOG
level is special and behaves differently from other levels:
- Always Visible: LOG messages are always displayed regardless of the configured log mode (except when OFF mode is set)
- Critical Information: Perfect for essential system messages, application lifecycle events, and operational information that must never be filtered out
- Green Color: Uses green coloring to distinguish it from other levels
- Use Cases: Application startup/shutdown, server listening notifications, critical configuration changes, deployment information
import { LogEngine, LogMode } from '@wgtechlabs/log-engine';
// Even with SILENT mode, LOG messages still appear
LogEngine.configure({ mode: LogMode.SILENT });
LogEngine.debug('Debug message'); // Hidden
LogEngine.info('Info message'); // Hidden
LogEngine.warn('Warning message'); // Hidden
LogEngine.error('Error message'); // Hidden
LogEngine.log('Server started on port 3000'); // β
Always visible!
// But with OFF mode, even LOG messages are hidden
LogEngine.configure({ mode: LogMode.OFF });
LogEngine.log('This LOG message is hidden'); // β Hidden with OFF mode
The OFF
mode provides complete logging silence when you need to disable all output:
- Total Silence: Disables ALL logging including the special LOG level messages
- Testing & CI/CD: Perfect for automated testing environments where no console output is desired
- Performance: Minimal overhead when logging is completely disabled
- Use Cases: Unit tests, CI/CD pipelines, production environments requiring zero log output
import { LogEngine, LogMode } from '@wgtechlabs/log-engine';
// Comparison: SILENT vs OFF
LogEngine.configure({ mode: LogMode.SILENT });
LogEngine.info('Info message'); // Hidden
LogEngine.log('Critical message'); // β
Still visible with SILENT
LogEngine.configure({ mode: LogMode.OFF });
LogEngine.info('Info message'); // Hidden
LogEngine.log('Critical message'); // β Hidden with OFF - complete silence!
Log messages are beautifully formatted with colorized timestamps, levels, and smart terminal output:
# Example colorized output (colors visible in terminal)
[2025-05-29T16:57:45.678Z][4:57PM][DEBUG]: Debugging application flow
[2025-05-29T16:57:46.123Z][4:57PM][INFO]: Server started successfully
[2025-05-29T16:57:47.456Z][4:57PM][WARN]: API rate limit approaching
[2025-05-29T16:57:48.789Z][4:57PM][ERROR]: Database connection failed
[2025-05-29T16:57:49.012Z][4:57PM][LOG]: Application startup complete
Color Scheme:
- π£ DEBUG: Magenta/Purple - Detailed debugging information
- π΅ INFO: Blue - General informational messages
- π‘ WARN: Yellow - Warning messages that need attention
- π΄ ERROR: Red - Error messages requiring immediate action
- π’ LOG: Green - Critical messages that always display
- β« Timestamps: Gray (ISO) and Cyan (local time) for easy scanning
Join our community discussions to get help, share ideas, and connect with other users:
- π£ Announcements: Official updates from the maintainer
- πΈ Showcase: Show and tell your implementation
- π Wall of Love: Share your experience with the library
- π Help & Support: Get assistance from the community
- π§ Ideas: Suggest new features and improvements
Need assistance with the library? Here's how to get help:
- Community Support: Check the Help & Support category in our GitHub Discussions for answers to common questions.
- Ask a Question: Create a new discussion if you can't find answers to your specific issue.
- Documentation: Review the usage instructions in this README for common examples and configurations.
- Known Issues: Browse existing issues to see if your problem has already been reported.
Please report any issues, bugs, or improvement suggestions by creating a new issue. Before submitting, please check if a similar issue already exists to avoid duplicates.
For security vulnerabilities, please do not report them publicly. Follow the guidelines in our security policy to responsibly disclose security issues.
Your contributions to improving this project are greatly appreciated! πβ¨
Contributions are welcome, create a pull request to this repo and I will review your code. Please consider to submit your pull request to the dev
branch. Thank you!
Read the project's contributing guide for more info, including testing guidelines and requirements.
Like this project? Leave a star! βββββ
There are several ways you can support this project:
- Become a sponsor and get some perks! π
- Buy me a coffee if you just love what I do! β
Found this project helpful? Consider nominating me (@warengonzaga) for the GitHub Star program! This recognition supports ongoing development of this project and my other open-source projects. GitHub Stars are recognized for their significant contributions to the developer community - your nomination makes a difference and encourages continued innovation!
I'm committed to providing a welcoming and inclusive environment for all contributors and users. Please review the project's Code of Conduct to understand the community standards and expectations for participation.
This project is licensed under the GNU Affero General Public License v3.0. This license requires that all modifications to the code must be shared under the same license, especially when the software is used over a network. See the LICENSE file for the full license text.
This project is created by Waren Gonzaga under WG Technology Labs, with the help of awesome contributors.
π» with β€οΈ by Waren Gonzaga under WG Technology Labs, and Him π