quick-logger-js
v1.0.3
Published
High-performance TypeScript logger inspired by NestJS
Downloads
498
Maintainers
Readme
quicklogger
🚀 A NestJS-inspired TypeScript logger prioritizing blazing speed, performance, and simplicity.
Features
- ⚡️ High-performance logging
- 🎨 Colorized output
- 🎯 TypeScript support
- ⏱️ Optional timestamps with time differences
- 🔍 Contextual logging
- 📊 Multiple log levels
- 🛠️ Configurable and extensible
Installation
npm i quick-logger-js
Quick Start
import { QuickLogger } from 'quick-logger-js';
// Create a logger instance
const logger = new QuickLogger({
context: 'MyApp',
timestamp: true
});
// Basic logging
logger.log('Application started');
logger.info('Server running on port 3000');
logger.warn('Resource usage high');
logger.error('Connection failed');
Configuration
Log Levels
log
: Standard logserror
: Error messageswarn
: Warning messagesdebug
: Debug informationverbose
: Detailed informationfatal
: Critical errors
Context Usage
// Global context from constructor
const logger = new QuickLogger({ context: 'MyApp' });
// Per-message context
logger.log('User logged in', 'Auth');
logger.error('Database connection failed', 'Database');
Performance
quicklog
is designed for high-performance logging with:
- Minimal overhead
- Optimized string concatenation
- Efficient memory usage
- No unnecessary object allocations
License
MIT
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.