robertsaupe / php-logger
php library to create a logger
Fund package maintenance!
robertsaupe
Patreon
Paypal
Amazon
Requires
- php: >=8.2.0
- symfony/filesystem: ^7
Requires (Dev)
- phpstan/phpstan: ^1
README
php library to create a logger
Supporting
GitHub | Patreon | PayPal | Amazon
Installing
composer require robertsaupe/php-logger
Getting started
Basic
use robertsaupe\Logger\LogBasic; $logger = new LogBasic(); $logger->error('error'); $logger->warning('warning'); $logger->info('info'); $logger->normal('normal'); $logger->verbose('verbose'); $logger->veryverbose('veryverbose'); $logger->debug('debug'); //return messageObject $message = $logger->normal("Testmessage"); print_r($message); print_r($message->getArray()); //return all messages print($logger->getFormattedMessagesByVerbosity()); //return all messages as html print($logger->getFormattedMessagesByVerbosity(true));
File
use robertsaupe\Logger\LogFile; $logger = new LogFile(dirname(__DIR__).'/logs', 'test'); //now writes the messages to a log-file
HTML
use robertsaupe\Logger\LogHTML; $logger = new LogHTML(dirname(__DIR__).'/logs', 'test'); //now writes the messages to a html-file
Credits
- Symfony for Filesystem