robertsaupe/php-logger

php library to create a logger

1.0.5 2024-02-21 10:23 UTC

This package is auto-updated.

Last update: 2024-12-21 12:05:33 UTC


README

Minimum PHP version: 8.2 Packagist Version Packagist Downloads License

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