qshurick/logger
Composer 安装命令:
composer require qshurick/logger
包简介
Logger abstract layer
关键字:
README 文档
README
Abstract Logger engine to integrate any Logger with ZendFramework2
Usage
By default it can be used without additional configuration.
namespace some\namespace;
class MyClass {
protected $logger;
/** ... */
function __construct() {
$this->logger = \Logger\Logger::getLogger(__CLASS__);
}
public function doSomething() {
/** ... */
$this->logger->info("Something is done");
}
}
Configuration
Default configuration present at config/logger.global.php which should be copied into in one of the config_glob_paths ZF2 Application.
Available options
adapter— adapter class name or its alias, default value id 'monolog'level— default log level. Should be a lowercase string with one of the following values: debug|info|notice|warning|error|critical|alert|emergencysystem— specify default path for a log fileerror— specify default path for a error logformat— log format, this value depends on logger adapter
Example
return array(
"logger" => array(
"adapter" => "\\CompanyName\\Logger\\Adapter",
"level" => "warning",
"system" => APPLICATION_LOG_PATH . "default.log",
"error" => APPLICATION_LOG_PATH . "error.log",
"format" => "[$date] [$level] [$session] $stream $message\n"
),
);
Additional options
Also you can specify different options for each of log stream. Specified parameters are: level, path and format. All element are optional, if one of them missed system (default) value will be used.
Example
return array(
"logger" => array(
"my-stream-name" => array(
"level" => "error",
"path" => "/some/custom/path/my.log",
"format" => "[$date] $message"
),
"\\My\\Class\\ForDebug" => array(
"level" => "debug"
),
"\\Some\\Specific\\Class" => array(
"path" => "/tmp/other.log"
),
),
);
统计信息
- 总下载量: 52
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 4
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2014-08-06