devgroup/yii2-graylog-target 问题修复 & 功能扩展

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

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

devgroup/yii2-graylog-target

Composer 安装命令:

composer require devgroup/yii2-graylog-target

包简介

Graylog2 log target for Yii2 framework applications

README 文档

README

Graylog2 log target for Yii2 framework applications

Travis build

Latest Stable Version Total Downloads Latest Unstable Version License

composer.lock available

Installation

For installation the yii2-graylog-target library in your projects as composer dependency, run the command:

php composer.phar require "devgroup/yii2-graylog-target:*"

... or just add to composer.json file the following line:

"devgroup/yii2-graylog-target": "*"

Configuration

Configure from config array

'components' => [
  'log' => [
    'grayii' => [
      'transport' => [
        'class' => \Gelf\Transport\HttpTransport::class,
        'host' => 'http://graylog2-server.com',
        'port' => 12201,
      ],
      'appName' => 'app name',
    ]
  ]
]
Available config parameters:
Param key Optional Default value Description
transport + Gelf\Transport\HttpTransport Transport config array for publishing a message to Graylog2 server
publisher + Gelf\Publisher Publisher config array
messageValidator + Gelf\MessageValidator Message validator class for publisher
container + \Yii::$container DI container
version + 1.1 GELF spec version
appName + ID of the application Category name for log message

Usage

  • Sent additional data:

    Yii::info([
      'short' => 'Short message or title',  // required. alternate usage variant: `Short message or title` (without a key 'short', but first item in array)
      'full' => 'Full message',             // optional. full message of log. For example, may be a stack trace as string or other detalized message
      '_field1' => 'value1',                // optional. additional field starts with '_' symbol
      '_field2' => 'value2',                // optional. additional field starts with '_' symbol
    ]);
  • Sent exception:

    try {
      ... running code with harmful bugs...
    } catch (\Throwable $t) {
      Yii::warning($t);
    }
  • Sent short message:

    Yii::trace('The short message example'); // or equivalent usage is Yii::trace(['The short message example']);

Tests

Tests was placed int the test directory. Tests can be running by the command:

php composer.phar exec codecept run

Tests with different php versions with docker:

  • PHP v5.6

    docker run -it --rm --name php56-for-grayii-tests -v "$PWD":/usr/src/myapp -w /usr/src/myapp php:5.6-cli php vendor/bin/codecept run

  • PHP v7.0

    docker run -it --rm --name php70-for-grayii-tests -v "$PWD":/usr/src/myapp -w /usr/src/myapp php:7.0-cli php vendor/bin/codecept run

  • HHVM

    docker run -it --rm --name hhvm-for-grayii-tests -v "$PWD":/usr/src/myapp -w /usr/src/myapp diegomarangoni/hhvm:cli hhvm vendor/bin/codecept run

统计信息

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

GitHub 信息

  • Stars: 5
  • Watchers: 2
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: BSD
  • 更新时间: 2016-11-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固