vbelozyorov/monolog-gearman-handler 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

vbelozyorov/monolog-gearman-handler

Composer 安装命令:

composer require vbelozyorov/monolog-gearman-handler

包简介

Gearman Handler for Monolog logging library

README 文档

README

Monolog handler for sending logs to Gearman. May be usefull for async recording those logs on another machine.

Requirements

As you see from package name, this one is useless without Gearman PHP extension . Since Composer cannot install it, you need to do it yourself.

Install

composer require vbelozyorov/monolog-gearman-handler

This will install this package itself and, Monolog, if not yet installed.

Configure

Because handler constructor requires Gearman client, which in turn requires host and port of Gearman server, you need to be able to provide all this when logger will initialized.

Here is example for YAML config for Symfony2:

services:
    gearman.client:
        class: GearmanClient
        calls:
            - [addServer, [%logs.gearman_host%, %logs.gearman_port%]]

    monolog.gearman_handler:
        class: Monolog\Handler\GearmanHandler
        arguments:
            - '@gearman.client'
        calls:
            - [setPrefix, ['project_alias']]

monolog:
    channels: [gearman]
    handlers:
        gearman:
            type:   service
            id:     monolog.gearman_handler
            level:  debug
            channels: [gearman]

        main:
            channels: ['!gearman']

In this example separate Monolog channell named gearman is registered. And handler main using in Symfony app by default excludes from this new channel. This way event logs like kernel.debug won't be published there.

How you get Gearman logger with this config:

$logger = $this->getContainer()->get('monolog.logger.gearman');

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-03-31

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固