diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-05-07 01:55:06 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2014-05-09 23:26:20 +0200 |
commit | b4298c68ca3b79abb7413452311daf074206c31c (patch) | |
tree | 1756de68d62958f705fabd11ba87b6e22fac7079 /lib/private/log.php | |
parent | 1083085e6e1727d3e9008c0f8a0729fbdade39f3 (diff) | |
download | nextcloud-server-b4298c68ca3b79abb7413452311daf074206c31c.tar.gz nextcloud-server-b4298c68ca3b79abb7413452311daf074206c31c.zip |
- make logger available in the container
- inject logger class into log
- adding PHPDoc comments and fixing typos
Diffstat (limited to 'lib/private/log.php')
-rw-r--r-- | lib/private/log.php | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/lib/private/log.php b/lib/private/log.php index e0b9fe3c696..c7a3b99a5e0 100644 --- a/lib/private/log.php +++ b/lib/private/log.php @@ -8,6 +8,8 @@ namespace OC; +use \OCP\ILogger; + /** * logging utilities * @@ -18,8 +20,24 @@ namespace OC; * MonoLog is an example implementing this interface. */ -class Log { - private $logClass; +class Log implements ILogger { + + private $logger; + + /** + * @param string $logger The logger that should be used + */ + public function __construct($logger=null) { + // FIXME: Add this for backwards compatibility, should be fixed at some point probably + if($logger === null) { + $this->logger = 'OC_Log_'.ucfirst(\OC_Config::getValue('log_type', 'owncloud')); + call_user_func(array($this->logger, 'init')); + } else { + $this->logger = $logger; + } + + } + /** * System is unusable. @@ -112,10 +130,6 @@ class Log { $this->log(\OC_Log::DEBUG, $message, $context); } - public function __construct() { - $this->logClass = 'OC_Log_'.ucfirst(\OC_Config::getValue('log_type', 'owncloud')); - call_user_func(array($this->logClass, 'init')); - } /** * Logs with an arbitrary level. @@ -130,7 +144,7 @@ class Log { } else { $app = 'no app in context'; } - $logClass=$this->logClass; - $logClass::write($app, $message, $level); + $logger=$this->logger; + $logger::write($app, $message, $level); } } |