sergeymakinen/yii2-log-message 问题修复 & 功能扩展

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

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

sergeymakinen/yii2-log-message

最新稳定版本:v2.1.0

Composer 安装命令:

composer require sergeymakinen/yii2-log-message

包简介

Log message object for Yii 2 log targets

README 文档

README

Log message object that wraps a log message and exposes its properties as well as the current request/user details to Yii 2 log targets.

Code Quality Build Status Code Coverage SensioLabsInsight

Packagist Version Total Downloads Software License

Installation

The preferred way to install this extension is through composer.

Either run

composer require "sergeymakinen/yii2-log-message:^2.0"

or add

"sergeymakinen/yii2-log-message": "^2.0"

to the require section of your composer.json file.

Usage

Let's take a look at the Slack log target code excerpt:

// ...
// $message is the sergeymakinen\yii\logmessage\Message class instance
$attachment = [
    'fallback' => $this->encode($this->formatMessage($message->message)),
    'title' => ucwords($message->level),
    'fields' => [],
    'text' => "```\n" . $this->encode($message->text . "\n```",
    'footer' => static::className(),
    'ts' => (int) round($message->timestamp),
    'mrkdwn_in' => [
        'fields',
        'text',
    ],
];
if ($message->isConsoleRequest) {
    $attachment['author_name'] = $message->commandLine;
} else {
    $attachment['author_name'] = $attachment['author_link'] = $message->url;
}
if (isset($this->colors[$message->message[1]])) {
    $attachment['color'] = $this->colors[$message->message[1]];
}
$this
    ->insertField($attachment, 'Level', $message->level, true, false)
    ->insertField($attachment, 'Category', $message->category, true)
    ->insertField($attachment, 'Prefix', $message->prefix, true)
    ->insertField($attachment, 'User IP', $message->userIp, true, false)
    ->insertField($attachment, 'User ID', $message->userId, true, false)
    ->insertField($attachment, 'Session ID', $message->sessionId, true)
    ->insertField($attachment, 'Stack Trace', $message->stackTrace, false);
// ...

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 未知