定制 timewave/laravel-logger 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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! :O
  • warning: The chaos is near
  • info: All is well, but this message is important
  • verbose: Extra info, likely good in a production environment
  • debug: A lot of detailed logs to debug your application [default]

Log formats

  • json: Outputs a string of a JSON object
  • text: 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

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-10-11