cxj / phpsyslog
Simple PSR-3 logger implementation that outputs to syslog
Installs: 1 543
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 1
Requires
- php: >=7.4
- psr/log: ^1
Requires (Dev)
- ergebnis/composer-normalize: ^2.6
- php-mock/php-mock-phpunit: ^2.6
- phpstan/phpstan: ^0.12
- phpstan/phpstan-phpunit: ^0.12
- phpunit/phpunit: ^9.1
- roave/security-advisories: dev-master
README
A minimalist, simple PSR-3 logger implementation which logs to a POSIX syslog.
Installation
This class requires PHP 5.4 or later, but we recommend using the latest available version of PHP as a matter of principle. It has two dependencies, the FIG PSR-3 interface, linked above, and IcecaveStudios/isolater which is used to isolate global functions to make them more easily tested.
It is installable and autoloadable via Composer as cxj/phpsyslog from Packagist.
Alternatively, download a releasefrom GitHub, or clone this repository. Then require or include its autoload.php file.
Quality
This class attempts to comply with PSR-1, PSR-2, and PSR-4. If you notice compliance oversights, please send a patch via pull request.
This package is unit tested using PHPUnit.
Usage
Example usage:
<?php $ident = basename($argv[0]); $logger = new Cxj\Logger($ident, Psr\Log\LogLevel::WARNING); // Will be logged. $logger->alert("This is an alert level message."); // Not logged because lower level than default WARNING level set in constructor. $logger->debug("This is a debug level message."); ?>
Contributing
Pull requests are welcome!
Requests which follow the PSR-1 and PSR-2 coding and style standards, and which have PHPUnit test coverage will get most attention.