-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding a log adapter for Symfony - which caused interface change
The LoggerInterface now uses the same methods as the Symfony HttpKernel LoggerInterface. This just means instead of a singular 'log' method, there are several methods that can be used to log a message. (eg. debug, crit, emerg, warn, notice, etc)
- Loading branch information
1 parent
7cb7150
commit 91c06ad
Showing
6 changed files
with
157 additions
and
28 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Presque package. | ||
* | ||
* (c) Justin Rainbow <justin.rainbow@gmail.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Presque\Log; | ||
|
||
/** | ||
* Abstract log adapter for Presque | ||
*/ | ||
abstract class AbstractLogAdapter implements LoggerInterface | ||
{ | ||
protected $log; | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function emerg($message, array $context = array()) | ||
{ | ||
$this->log->emerg($message, $context); | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function alert($message, array $context = array()) | ||
{ | ||
$this->log->alert($message, $context); | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function crit($message, array $context = array()) | ||
{ | ||
$this->log->crit($message, $context); | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function err($message, array $context = array()) | ||
{ | ||
$this->log->err($message, $context); | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function warn($message, array $context = array()) | ||
{ | ||
$this->log->warn($message, $context); | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function notice($message, array $context = array()) | ||
{ | ||
$this->log->notice($message, $context); | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function info($message, array $context = array()) | ||
{ | ||
$this->log->info($message, $context); | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function debug($message, array $context = array()) | ||
{ | ||
$this->log->debug($message, $context); | ||
} | ||
} |
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,28 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Presque package. | ||
* | ||
* (c) Justin Rainbow <justin.rainbow@gmail.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Presque\Log; | ||
|
||
use Symfony\Component\HttpKernel\Log\LoggerInterface as SymfonyLoggerInterface; | ||
|
||
/** | ||
* Symfony HttpKernel LoggerInterface adapter | ||
*/ | ||
class SymfonyLogAdapter extends AbstractLogAdapter | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function __construct(SymfonyLoggerInterface $logObject) | ||
{ | ||
$this->log = $logObject; | ||
} | ||
} |
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