-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NOT FINISHED implementing Yii 2.1 compatibility
- Loading branch information
Showing
6 changed files
with
108 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
/** | ||
* Automation tool mixed with code generator for easier continuous development | ||
* | ||
* @link https://github.com/hiqdev/hidev | ||
* @package hidev | ||
* @license BSD-3-Clause | ||
* @copyright Copyright (c) 2015-2018, HiQDev (http://hiqdev.com/) | ||
*/ | ||
|
||
namespace hidev\log; | ||
|
||
use Yii; | ||
use yii\helpers\Console; | ||
use yii\log\Logger; | ||
|
||
class OldConsoleTarget extends \yii\log\Target | ||
{ | ||
public $exportInterval = 1; | ||
|
||
public static $styles = [ | ||
Logger::LEVEL_WARNING => [Console::FG_YELLOW], | ||
Logger::LEVEL_ERROR => [Console::FG_RED], | ||
]; | ||
|
||
public function export() | ||
{ | ||
foreach ($this->messages as $message) { | ||
$this->out($message[0], $message[1]); | ||
} | ||
} | ||
|
||
public function out($message, $level) | ||
{ | ||
if ($level > $this->getLevel()) { | ||
return; | ||
} | ||
$style = self::$styles[$level]; | ||
if ($style) { | ||
$message = Console::ansiFormat($message, $style); | ||
} | ||
Console::stdout($message . "\n"); | ||
} | ||
|
||
public function getLevel() | ||
{ | ||
return Yii::$app->get('log')->getLevel(); | ||
} | ||
|
||
protected function getContextMessage() | ||
{ | ||
return ''; | ||
} | ||
} |