Releases: shinijs/logger
v1.2.0
Minor Changes
-
1e5da39: Add automatic log file rotation with configurable time-based and size-based strategies.
Features:
- Automatic daily log file rotation by default when file logging is enabled
- Configurable rotation frequency (daily, hourly, or custom intervals)
- Automatic cleanup of old log files based on retention policy (default: 7 files)
- Size-based rotation with configurable file size limits (default: 10MB)
- Custom date patterns for log file naming
- Full backward compatibility - existing configurations work without changes
- Seamless integration with pretty printing and multi-stream logging
- Uses official
pino-rolltransport for reliable rotation
New Environment Variables:
LOG_FILE_ROTATION_ENABLED- Enable/disable rotation (default: true when file logging enabled)LOG_FILE_ROTATION_FREQUENCY- Rotation frequency: 'daily', 'hourly', or 'custom' (default: 'daily')LOG_FILE_ROTATION_PATTERN- Date pattern for filenames (default: 'YYYY-MM-DD')LOG_FILE_MAX_FILES- Number of log files to retain (default: 7)LOG_FILE_SIZE_LIMIT- Maximum file size before rotation (default: '10M')
File Naming:
- Daily rotation:
app-2024-01-15.log - Hourly rotation:
app-2024-01-15-14.log - No rotation:
app.log(when explicitly disabled)
Breaking Changes:
None - this is a backward compatible enhancement. Existing users will automatically get daily rotation enabled, but can disable it withLOG_FILE_ROTATION_ENABLED=falseto maintain the previous single-file behavior.Migration:
No migration needed for most users. If you prefer the old single-file behavior, setLOG_FILE_ROTATION_ENABLED=falsein your environment variables.New Peer Dependency:
pino-roll: ^4.0.0- Install with:pnpm add pino-roll
v1.1.0
Minor Changes
-
f69a385: Add file logging support with pretty printing enabled and NestJS LoggerService compatibility.
Features:
- File logging now works when pretty printing is enabled (development mode)
- ContextBoundLogger now implements LoggerService for NestJS compatibility
- Added method overloads to support both ILogger and LoggerService signatures
- Fixed warn() method to properly handle single-argument calls from NestJS LoggerService
Breaking Changes:
None - this is a backward compatible enhancement.Migration:
No migration needed. Existing code continues to work. ContextBoundLogger can now be used wherever LoggerService is expected (e.g., in RateLimitModule.forRoot()).
v1.0.1
v1.0.0
🎉 @shinijs/logger v1.0.0 - Initial Release
We're excited to announce the first major release of @shinijs/logger - a powerful, Pino-based structured logger for NestJS applications.
✨ Features
- ✅ Pino-based - Fast, low-overhead structured logging
- ✅ NestJS Integration - Seamless integration with NestJS ecosystem
- ✅ Pretty Printing - Beautiful console output in development
- ✅ File Rotation - Automatic daily log file rotation
- ✅ Configurable - Environment-based configuration
- ✅ TypeScript - Full type safety
- ✅ Context Support - Scoped logging with context
🚀 Quick Start
pnpm add @shinijs/logger pino pino-prettySee the README for full documentation and examples.
📦 What's Included
This release includes:
LoggerModule- NestJS module for easy integrationCustomLogger- Main logger service implementing NestJSLoggerServiceLoggerFactory- Factory for creating context-bound loggers- Full TypeScript support with comprehensive type definitions
- Environment-based configuration
- Daily log file rotation
- Pretty printing for development environments
🔧 Requirements
- Node.js >= 20.0.0
- NestJS >= 11.0.0
- See peer dependencies for full requirements
📚 Documentation
Full documentation, examples, and API reference are available in the README.
🤝 Contributing
We welcome contributions! Please see our GitHub repository for more information.
Install now:
pnpm add @shinijs/logger pino pino-pretty