Created
August 5, 2011 22:25
-
-
Save davedevelopment/1128676 to your computer and use it in GitHub Desktop.
Logging Trait
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
<?php | |
/** | |
* Logging trait | |
* | |
* @author Dave Marshall <[email protected]> | |
*/ | |
trait Logging | |
{ | |
/** | |
* @var Zend_Log | |
*/ | |
protected $_logger = null; | |
/** | |
* Set logger | |
* | |
* @param Zend_Log $logger | |
* @return void | |
*/ | |
public function setLogger(Zend_Log $logger) | |
{ | |
$this->_logger = $logger; | |
} | |
/** | |
* Log something | |
* | |
* @param string $level | |
* @param string $msg | |
* @return void | |
*/ | |
protected function log($level, $msg) | |
{ | |
if ($this->_logger !== null) { | |
$this->_logger->{$level}($msg); | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment