https://github.com/sensorario/yaphlo
Yet another php logger
https://github.com/sensorario/yaphlo
Last synced: about 2 months ago
JSON representation
Yet another php logger
- Host: GitHub
- URL: https://github.com/sensorario/yaphlo
- Owner: sensorario
- License: mit
- Created: 2021-11-16T21:53:46.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-01-02T02:33:41.000Z (over 4 years ago)
- Last Synced: 2025-01-19T19:45:41.303Z (over 1 year ago)
- Language: PHP
- Size: 71.3 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# yaphlo
Yet another php logger
## Example with class configuration
```php
info(['write' => 'this']);
$logger->error(['write' => 'this']);
$logger->info(['write' => 'this'], 'channel A');
$logger->info(['write' => 'this'], 'channel B');
```
## Example with array configuration
I prefer this way because configuration can be placed into a configuration file and bla bla bla.
```php
[
'level' => 'INFO',
'enabledChannels' => [
'channel A',
],
],
];
$logger = new Logger(
new Message,
new Writer(
new ArrayConfig($config),
new WriterAdapter(
__DIR__ . '/logger.log',
)
)
);
$logger->info(['write' => 'this']);
$logger->error(['write' => 'this'], 'channel A');
```
## What both scripts will write in logs, ...
[2021-12-13 00:21:08] [INFO] [channel A] {
[2021-12-13 00:21:08] [INFO] [channel A] "write": "this"
[2021-12-13 00:21:08] [INFO] [channel A] }