diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2018-04-24 22:14:00 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2018-04-26 12:00:06 +0200 |
commit | 5fbf184134f34633bc150b2e0210c4a97ec285a9 (patch) | |
tree | bdc4d79196f1268cf8d5df488c9b31705ceb82a0 /lib/private/Log/Syslog.php | |
parent | b7e8ab97e731b77ef2ec519bfb98019516b7f682 (diff) | |
download | nextcloud-server-5fbf184134f34633bc150b2e0210c4a97ec285a9.tar.gz nextcloud-server-5fbf184134f34633bc150b2e0210c4a97ec285a9.zip |
destaticfy Log classes
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'lib/private/Log/Syslog.php')
-rw-r--r-- | lib/private/Log/Syslog.php | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/lib/private/Log/Syslog.php b/lib/private/Log/Syslog.php index 7b3d931ef31..be8ecdebb2e 100644 --- a/lib/private/Log/Syslog.php +++ b/lib/private/Log/Syslog.php @@ -26,22 +26,19 @@ namespace OC\Log; use OCP\ILogger; +use OCP\IConfig; -class Syslog { - static protected $levels = array( +class Syslog implements IWritable { + static protected $levels = [ ILogger::DEBUG => LOG_DEBUG, ILogger::INFO => LOG_INFO, ILogger::WARN => LOG_WARNING, ILogger::ERROR => LOG_ERR, ILogger::FATAL => LOG_CRIT, - ); + ]; - /** - * Init class data - */ - public static function init() { - openlog(\OC::$server->getSystemConfig()->getValue("syslog_tag", "ownCloud"), LOG_PID | LOG_CONS, LOG_USER); - // Close at shutdown + public function __construct(IConfig $config) { + openlog($config->getSystemValue('syslog_tag', 'ownCloud'), LOG_PID | LOG_CONS, LOG_USER); register_shutdown_function('closelog'); } @@ -51,7 +48,7 @@ class Syslog { * @param string $message * @param int $level */ - public static function write($app, $message, $level) { + public function write($app, $message, $level) { $syslog_level = self::$levels[$level]; syslog($syslog_level, '{'.$app.'} '.$message); } |