https://github.com/robertsaupe/php-logger
php library to create a logger
https://github.com/robertsaupe/php-logger
filelog filelogger html htmllogger htmllogging library log logger logging php php8
Last synced: 2 days ago
JSON representation
php library to create a logger
- Host: GitHub
- URL: https://github.com/robertsaupe/php-logger
- Owner: robertsaupe
- License: mit
- Created: 2022-06-01T10:08:06.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2024-02-21T10:24:19.000Z (over 2 years ago)
- Last Synced: 2025-02-15T01:19:21.785Z (over 1 year ago)
- Topics: filelog, filelogger, html, htmllogger, htmllogging, library, log, logger, logging, php, php8
- Language: PHP
- Homepage:
- Size: 21.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# php-logger
[](https://packagist.org/packages/robertsaupe/php-logger)
[](https://packagist.org/packages/robertsaupe/php-logger)
[](https://packagist.org/packages/robertsaupe/php-logger)
[](LICENSE)
php library to create a logger
## Supporting
[GitHub](https://github.com/sponsors/robertsaupe) |
[Patreon](https://www.patreon.com/robertsaupe) |
[PayPal](https://www.paypal.com/donate?hosted_button_id=SQMRNY8YVPCZQ) |
[Amazon](https://www.amazon.de/ref=as_li_ss_tl?ie=UTF8&linkCode=ll2&tag=robertsaupe-21&linkId=b79bc86cee906816af515980cb1db95e&language=de_DE)
## Installing
```sh
composer require robertsaupe/php-logger
```
## Getting started
### Basic
```php
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
```php
use robertsaupe\Logger\LogFile;
$logger = new LogFile(dirname(__DIR__).'/logs', 'test');
//now writes the messages to a log-file
```
### HTML
```php
use robertsaupe\Logger\LogHTML;
$logger = new LogHTML(dirname(__DIR__).'/logs', 'test');
//now writes the messages to a html-file
```
## Credits
- [Symfony](https://github.com/symfony) for [Filesystem](https://symfony.com/doc/current/components/filesystem.html)