Skip to content

Commit

Permalink
added nette logger
Browse files Browse the repository at this point in the history
  • Loading branch information
bazo committed May 1, 2012
1 parent 33d3c0d commit 73ac245
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions Bazo/Watchdog/NetteLogger.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php
namespace Bazo\Watchdog;
/**
* Description of Logger
*
* @author Martin
*/
class NetteLogger extends \Nette\Diagnostics\Logger
{
private
/** @var \Bazo\Watchdog\Client */
$watchdogClient
;

public function __construct(\Bazo\Watchdog\Client $watchdogClient)
{
$this->watchdogClient = $watchdogClient;
}

public function log($message, $priority = self::INFO)
{
$res = parent::log($message, $priority);

$levelMap = array(
self::DEBUG => Alert::NOTICE,
self::CRITICAL => Alert::ERROR,
self::ERROR => Alert::ERROR,
self::INFO => Alert::INFO,
self::WARNING => Alert::ERROR
);

$level = $levelMap[$priority];

$this->watchdogClient->log($message, $level);
return $res;
}
}

0 comments on commit 73ac245

Please sign in to comment.