2017 © Pedro Peláez
 

library yii2-log-message

Log message object for Yii 2 log targets

image

sergeymakinen/yii2-log-message

Log message object for Yii 2 log targets

  • Monday, February 12, 2018
  • by sergeymakinen
  • Repository
  • 2 Watchers
  • 1 Stars
  • 10,006 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 5 Versions
  • 17 % Grown

The README.md

Yii 2 log message object

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., (*1)

Code Quality Build Status Code Coverage SensioLabsInsight, (*2)

Packagist Version Total Downloads Software License, (*3)

Installation

The preferred way to install this extension is through composer., (*4)

Either run, (*5)

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

or add, (*6)

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

to the require section of your composer.json file., (*7)

Usage

Let's take a look at the Slack log target code excerpt:, (*8)

// ...
// $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);
// ...

The Versions

12/02 2018

dev-master

9999999-dev https://github.com/sergeymakinen/yii2-log-message

Log message object for Yii 2 log targets

  Sources   Download

MIT

The Requires

 

The Development Requires

log logging yii2 yii message yii2-log-message

12/02 2018

v2.1.0

2.1.0.0 https://github.com/sergeymakinen/yii2-log-message

Log message object for Yii 2 log targets

  Sources   Download

MIT

The Requires

 

The Development Requires

log logging yii2 yii message yii2-log-message

17/08 2017

v2.0.1

2.0.1.0 https://github.com/sergeymakinen/yii2-log-message

Log message object for Yii 2 log targets

  Sources   Download

MIT

The Requires

 

The Development Requires

log logging yii2 yii message yii2-log-message

25/01 2017

v2.0.0

2.0.0.0 https://github.com/sergeymakinen/yii2-log-message

Log message object for Yii 2 log targets

  Sources   Download

MIT

The Requires

 

The Development Requires

log logging yii2 yii message yii2-log-message

04/01 2017

v1.0.0

1.0.0.0 https://github.com/sergeymakinen/yii2-log-message

Log message object for Yii 2 log targets

  Sources   Download

MIT

The Requires

 

The Development Requires

log logging yii2 yii message yii2-log-message