enrise/psr-log-extension
最新稳定版本:1.0.1
Composer 安装命令:
composer require enrise/psr-log-extension
包简介
An extension to the Psr\Log package
README 文档
README
This repository contains an extension on the LoggerAwareTrait that comes with the Psr\Log package.
It contains convenience methods to use the LoggerAwareInterface implementation in a safe way. Meaning you don't have
to care whether the class you're implementing actually has a logger instance attached to it.
Usage example
The example below works whether a logger instance has been attached or not.
use Psr\Log\LoggerAwareInterface; use Enrise\Log\LoggerAwareTrait; class Foo implements LoggerAwareInterface { use LoggerAwareTrait; function bar() { $this->logDebug('Write a debug statement to the log'); } } $foo = new Foo(); $foo->bar(); // All fine $foo->setLogger(new ConcreteLogger()); $foo->bar(); // Writes to the logger as usual
Credits
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 5.09k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-03-16