A simple PSR-3 Logger
- PHP 100%
|
Thomas Ernst
6bdf56b6f7
All checks were successful
ci / ci (push) Successful in 1m7s
|
||
|---|---|---|
| .forgejo/workflows | Allow manual CI runs | |
| .github | Update github readme | |
| docs | Update docs tooling | |
| src | The big rename | |
| tests | The big rename | |
| .editorconfig | Sync shared config files | |
| .gitattributes | Update .gitattributes | |
| .gitignore | Update coverage path | |
| CHANGELOG.md | Release v0.3.0 | |
| composer.json | Require dev package v4.2 | |
| LICENSE.md | Update license | |
| mago.toml | Add linter rules | |
| phpunit.xml.dist | Update coverage config | |
| psalm.xml.dist | Rename phpunit and psalm config | |
| README.md | Update README badges | |
Celemas Log
ci code coverage type coverage psalm level Software License
A simple PSR-3 logger using PHP's error_log function.
Installation
composer require celemas/log
Usage
Create a logger without arguments to write to PHP's default SAPI error logger.
use Celemas\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.
License
This project is licensed under the MIT license.