7, ILogger::INFO => 6, ILogger::WARN => 4, ILogger::ERROR => 3, ILogger::FATAL => 2, ]; protected string $syslogId; public function __construct( SystemConfig $config, ?string $tag = null, ) { parent::__construct($config); if (!function_exists('sd_journal_send')) { throw new HintException( 'PHP extension php-systemd is not available.', 'Please install and enable PHP extension systemd if you wish to log to the Systemd journal.'); } if ($tag === null) { $tag = $config->getValue('syslog_tag', 'Nextcloud'); } $this->syslogId = $tag; } /** * Write a message to the log. * @param string|array $message */ public function write(string $app, $message, int $level): void { $journal_level = $this->levels[$level]; sd_journal_send('PRIORITY=' . $journal_level, 'SYSLOG_IDENTIFIER=' . $this->syslogId, 'MESSAGE=' . $this->logDetailsAsJSON($app, $message, $level)); } }