Skip to content

Commit

Permalink
+ styled Console log output
Browse files Browse the repository at this point in the history
  • Loading branch information
hiqsol committed May 12, 2015
1 parent 8813192 commit 98d97df
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions components/Logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ class Logger extends \yii\log\Logger
{

public static $styles = [
Logger::LEVEL_WARNING => Console::FG_YELLOW,
Logger::LEVEL_ERROR => Console::FG_RED,
Logger::LEVEL_WARNING => [Console::FG_YELLOW],
Logger::LEVEL_ERROR => [Console::FG_RED],
];

/**
Expand All @@ -35,7 +35,10 @@ class Logger extends \yii\log\Logger
public function log($message, $level, $category = 'application')
{
if ($level <= static::LEVEL_TRACE) {
//d(Console::ansiFormat($message, Console::FG_YELLOW));
$style = self::$styles[$level];
if ($style) {
$message = Console::ansiFormat($message, $style);
}
Console::stdout($message."\n");
}
parent::log($message, $level, $category);
Expand Down
2 changes: 1 addition & 1 deletion handlers/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function parsePath($path)
*/
protected function write($path, $content)
{
Yii::info('Written file: ' . $path,'file');
Yii::warning('Written file: ' . $path,'file');
file_put_contents($path, $content);
}

Expand Down

0 comments on commit 98d97df

Please sign in to comment.