oat-sa/lib-correlation-ids-monolog 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

oat-sa/lib-correlation-ids-monolog

Composer 安装命令:

composer require oat-sa/lib-correlation-ids-monolog

包简介

OAT Correlation Ids Monolog Library

README 文档

README

PHP library for correlation ids monolog processor based on the correlation ids library.

Table of contents

Installation

$ composer require oat-sa/lib-correlation-ids-monolog

Principles

This library provides a ready to use monolog processor that will extend the logs context with the correlation ids fetched from the correlation ids registry.

Usage

You need to push the CorrelationIdsMonologProcessor to your logger as follow:

<?php declare(strict_types=1);

use OAT\Library\CorrelationIds\Registry\CorrelationIdsRegistry;
use OAT\Library\CorrelationIds\Registry\CorrelationIdsRegistryInterface;
use OAT\Library\CorrelationIdsMonolog\Processor\CorrelationIdsMonologProcessor;
use Monolog\Logger;

/** @var CorrelationIdsRegistryInterface $registry */
$registry = new CorrelationIdsRegistry(...);

$logger = new Logger('channel-name');
$logger->pushProcessor(new CorrelationIdsMonologProcessor($registry));

...

$logger->info('log message'); // this log entry context will be automatically populated with the correlation ids.

Note: you can customize the log context key names by providing you own CorrelationIdsHeaderNamesProviderInterface implementation and pass it to the CorrelationIdsMonologProcessor constructor.

Tests

To run tests:

$ vendor/bin/phpunit

Note: see phpunit.xml.dist for available test suites.

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 40
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0-only
  • 更新时间: 2019-11-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固