celema / log
A simple PSR-3 Logger
Requires
- php: ^8.5
- psr/log: ^3.0
Requires (Dev)
- carthage-software/mago: 1.50.0
- ernst/coverlyzer: ^0.3
- infection/infection: 0.35.6
- phpunit/phpunit: ^13.0
- vimeo/psalm: 6.19.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
A simple PSR-3 logger using PHP's error_log function.
Installation
composer require celema/log
Usage
Create a logger without arguments to write to PHP's default SAPI error logger.
use Celema\Log\Logger; $logger = new Logger(); $logger->info('Application started');
See the documentation for file logging, level filtering, and formatter usage.
Testing
During testing, PHP's error_log ini setting is set to a temporary file. To print the output to the console, prepend a special env variable to the PHPUnit cli command, as follows:
ECHO_LOG=1 phpunit
Test Environment Requirements
Tests require:
ini_set()function enabled (forerror_logredirection)- Writable system temp directory (for test log file isolation)
- PHP
error_reportingmust be modifiable
These are standard in development environments but may fail in restricted PHP configurations where ini_set is disabled via disable_functions.
Mutation testing
Mutation testing with Infection is not part of composer ci, but the CI workflow runs it after the coverage step and enforces the minimum mutation score from infection.json5.dist. Pushes only mutate the changed lines; a weekly scheduled run covers the whole codebase. Run it locally with:
composer mutation
Reports are written to .infection/.
License
This project is licensed under the MIT license.