timewave/laravel-logger
最新稳定版本:0.2.2
Composer 安装命令:
composer require timewave/laravel-logger
包简介
Logging library
README 文档
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.
统计信息
- 总下载量: 325
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-10-11