timewave / logger
Logging library
Installs: 7 284
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
pkg:composer/timewave/logger
Requires
- php: ^8.0
This package is not auto-updated.
Last update: 2025-11-20 19:04:38 UTC
README
Custom logger package for PHP applications with opinionated log levels.
Usage
There will always be output to stdout. If Open Telemetry is configured, it will be pushed there to.
Basic usage:
$log = new CustomLogger('my-app-name'); $log->otlpHttpHost = 'http://localhost:4318'; $log->info('Something happened', ['key' => 'value']);
Usage with spans
$log = new CustomLogger('auth-4'); $log->otlpHttpHost = 'http://localhost:4318'; $requestSpan = $log->createSpanLogger('request', ['requestId' => 'Legodalf']); $requestSpan->verbose('Incoming request', ['method' => 'POST', 'path' => '/auth/password']); $loginSpan = $requestSpan->createSpanLogger('login', ['username' => 'siv']); $loginSpan->info('User is trying to login'); $userId = User::login('siv'); $loginSpan->verbose('User is logged in'); $loginSpan->endSpan(); $requestSpan->debug('Request is over'); $requestSpan->endSpan();
Log levels
error: Apocalypse! :Owarning: The chaos is nearinfo: All is well, but this message is importantverbose: Extra info, likely good in a production environmentdebug: A lot of detailed logs to debug your application [default]
Log formats
json: Outputs a string of a JSON objecttext: Outputs a simple string [default]
Open Telemetry Collector endpoint
A DSN string, example: 'http://localhost:4318'. The target must be a protobuf endpoint.
Local development
Either register an auto loader, or explicitly require all PHP-files in this repo, and then just start using and developing.