aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Log/Syslog.php
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2019-07-16 10:15:00 +0200
committerJulius Härtl <jus@bitgrid.net>2019-07-17 08:45:55 +0200
commit07bbec33559a104e844fd1d6960f3f2d7be3fa21 (patch)
tree0c85619c8641cfbd2baf9abfa2b823153ab50b18 /lib/private/Log/Syslog.php
parentc048c56411d86a3f8509ddae66743d4f189f2deb (diff)
downloadnextcloud-server-07bbec33559a104e844fd1d6960f3f2d7be3fa21.tar.gz
nextcloud-server-07bbec33559a104e844fd1d6960f3f2d7be3fa21.zip
Move log detail aggregation to separate class and reuse it in syslog/systemd logger
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'lib/private/Log/Syslog.php')
-rw-r--r--lib/private/Log/Syslog.php9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/private/Log/Syslog.php b/lib/private/Log/Syslog.php
index b652eb4343d..b8fba34d62b 100644
--- a/lib/private/Log/Syslog.php
+++ b/lib/private/Log/Syslog.php
@@ -25,11 +25,11 @@
namespace OC\Log;
+use OC\SystemConfig;
use OCP\ILogger;
-use OCP\IConfig;
use OCP\Log\IWriter;
-class Syslog implements IWriter {
+class Syslog extends LogDetails implements IWriter {
protected $levels = [
ILogger::DEBUG => LOG_DEBUG,
ILogger::INFO => LOG_INFO,
@@ -38,7 +38,8 @@ class Syslog implements IWriter {
ILogger::FATAL => LOG_CRIT,
];
- public function __construct(IConfig $config) {
+ public function __construct(SystemConfig $config) {
+ parent::__construct($config);
openlog($config->getSystemValue('syslog_tag', 'Nextcloud'), LOG_PID | LOG_CONS, LOG_USER);
}
@@ -54,6 +55,6 @@ class Syslog implements IWriter {
*/
public function write(string $app, $message, int $level) {
$syslog_level = $this->levels[$level];
- syslog($syslog_level, '{'.$app.'} '.$message);
+ syslog($syslog_level, $this->logDetailsAsJSON($app, $message, $level));
}
}