承接 timewave/laravel-logger 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

timewave/laravel-logger

最新稳定版本:0.3.0

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.

Running tests

composer install
composer test

Or invoke PHPUnit directly: vendor/bin/phpunit.

统计信息

  • 总下载量: 325
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

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