定制 qshurick/logger 二次开发

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

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

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|emergency
  • system — specify default path for a log file
  • error — specify default path for a error log
  • format — 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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2014-08-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固