定制 yii2-extended/yii2-psr3-logger-bridge 二次开发

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

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

yii2-extended/yii2-psr3-logger-bridge

Composer 安装命令:

composer require yii2-extended/yii2-psr3-logger-bridge

包简介

A library to bridge psr-3 loggers with the yii logging system

README 文档

README

A library to bridge psr-3 loggers with the yii logging system

coverage build status

Installation

The installation of this library is made via composer and the autoloading of all classes of this library is made through their autoloader.

  • Download composer.phar from their website.
  • Then run the following command to install this library as dependency :
  • php composer.phar yii2-extended/yii2-psr3-logger-bridge ^9

Basic Usage

This library offers one psr3 compliant logger to log messages back to yii2 logging system. As Yii2 has a limited number of logging levels, this logger will attempt to use the closest Yii2 equivalent for the provided psr3 level.

If you are searching for the reverse (yii2 logger that logs to psr3 compliant targets, look at the official yii2-psr-log-target.

The Psr3ToYii2Logger is straightforward to use, just look at the PSR-3 documentation.

Any message that is logged by this logger will be transmitted to Yii's application log component.


use Yii2Extended\Yii2Log\Psr3ToYii2Logger;
use Psr\Log\LogLevel;
use yii\log\Logger;

$logger = new Psr3ToYii2Logger();
// with the psr3 methods
$logger->emergency('A psr3 emergency message, logged as Yii2 error message');
// with the psr3 log levels
$logger->log(LogLevel::ALERT, 'A psr3 alert message, logged as Yii2 error message');
// with the yii2 log levels
$logger->log(Logger::LEVEL_PROFILE_BEGIN, 'A yii2 profile begin message, logged as profile begin message');

Note that the messages that are passed through this component may use optionals __category__ and __language__ keys within the $context array. This will be useful to orient the category of the logging message, and the language in which it should be translated, in case of need (as the translation to yii interpolates the message with the context and tries to translate it, using the Yii::t() method).

License

MIT (See license file).

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-01-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固