myena/default-logger
Composer 安装命令:
composer require myena/default-logger
包简介
A simple PSR-3 compliant logger
README 文档
README
A simple PSR-3 compliant logger
Installation
This library is designed to be used with Composer
Require entry:
{
"myena/default-logger": "@stable"
}
Basic Usage
$logger = new \MyENA\DefaultLogger(); $logger->debug('hello!');
Defaults
The default level of this logger is debug
The default stream for this logger is php://output
Custom Levels
You may specify custom levels one of two ways:
Construction:
$logger = new \MyENA\DefaultLogger(\Psr\Log\LogLevel::INFO);
Post-Construction:
$logger->setLogLevel(\Psr\Log\LogLevel::INFO);
If you attempt to specify a level not denoted by \Psr\Log\LogLevel, an exception will be thrown.
Custom Stream
If you wish for the log output to go to a file or some other resource writeable by the fwrite function, you may pass it in as the 2nd argument.
$logger = new \MyENA\DefaultLogger(\Psr\Log\LogLevel::DEBUG, fopen('tmp/test.log', 'ab'));
If this file becomes un-writeable for some reason, it will attempt to reconstruct the internal resource. If it is unable, it will revert to using the stream returned by the defaultStream().
NOTE: No write-ability determination is done, if you pass in a read-only stream it will ultimately not work.
统计信息
- 总下载量: 1.29k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 5
- 依赖项目数: 3
- 推荐数: 1
其他信息
- 授权协议: MPL-2.0
- 更新时间: 2017-02-09