Download the PHP package solophp/logger without Composer
On this page you can find all versions of the php package solophp/logger. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package logger
Solo PSR-3 Logger
A lightweight PSR-3 compliant logger implementation with timezone support, file handling, and log rotation capabilities.
Installation
Install via composer:
Usage
Basic usage:
With custom timezone:
Change log file or timezone at runtime:
Features
- PSR-3 Logger Interface compliance
- Automatic log directory creation
- Custom timezone support
- Context interpolation
- Safe file handling with locks
- Support for all PSR-3 log levels
- Log rotation with size and time-based strategies
- Automatic cleanup of old log files
- Thread-safe rotation operations
- Modular architecture with clear separation of concerns
Requirements
- PHP 7.4 or higher
- psr/log package
Log Levels
The logger supports all PSR-3 log levels:
- emergency
- alert
- critical
- error
- warning
- notice
- info
- debug
Log Rotation
The logger supports automatic log rotation with multiple strategies to prevent disk overflow and simplify log management.
Rotation Strategies
Size-based rotation
Rotates logs when the file reaches a specified size limit:
Time-based rotation
Rotates logs at specified time intervals:
Combined rotation
Rotates logs when either size OR time condition is met:
Runtime Configuration
You can change rotation settings at runtime:
File Naming
When rotation occurs, files are created with timestamps:
Examples:
app_2025-08-03_14-30-15.log
error_2025-08-03_09-45-30.log
Best Practices
- Size limits: Set reasonable limits (1-10MB) to prevent disk overflow
- File count: Limit the number of files to save space
- Time intervals: Use standard intervals (1 hour, 6 hours, 1 day)
- Monitoring: Regularly check log directory size
- Archiving: Consider archiving old logs for long-term storage
Examples
Daily rotation with 30-day retention
Size-based with 50MB total limit
Combined strategy for high-traffic applications
Output Format
Logs are written in the following format:
Development
License
MIT License. See LICENSE file for details.