aboutsummaryrefslogtreecommitdiffstats
path: root/demos
Commit message (Expand)AuthorAgeFilesLines
* Combobox demo: Improved styling and added a title to the button, to avoid hav...jzaefferer2010-03-201-8/+5
* Autocomplete: Combobox demo - don't use position plugin to place the button n...Scott González2010-03-201-6/+5
* Menu: skip over elements that aren't menu items.Scott González2010-03-201-23/+0
* demos index: put effects in a more logical orderRichard Worth2010-03-181-2/+2
* demos index: put effects in a more logical orderRichard Worth2010-03-181-3/+3
* button default demo: moved prevent navigation to # when clicking on anchor bu...Richard Worth2010-03-181-2/+4
* demos: html validationRichard Worth2010-03-181-4/+4
* eol-style and mime-typeRichard Worth2010-03-172-163/+163
* position demo - fixed html validation issue. Hopefully will fix #5358 - Posit...Richard Worth2010-03-171-86/+84
* autocomplete: combobox demo: tweaked padding to be more consistent across bro...Richard Worth2010-03-151-1/+2
* autocomplete demo: corrected spelling of perlRichard Worth2010-03-151-1/+1
* button demo: minor updateRichard Worth2010-03-151-2/+2
* Button demo: added descriptionRichard Worth2010-03-151-1/+3
* html pages: added HTML5 meta charset UTF-8 tag, changed DOCTYPE to uppercaseRichard Worth2010-03-12140-302/+442
* button default demo: prevent navigation to # when clicking on anchor buttonRichard Worth2010-03-101-1/+1
* Datepicker: Tamil localisationKeith Wood2010-03-022-0/+3
* Button demo: Fixed duplicate id.Scott González2010-03-021-2/+2
* Datepicker: Add Faroese localisationKeith Wood2010-02-262-0/+3
* ajax tabs demo: renamed tabs to fit on the demo templateJörn Zaefferer2010-02-241-5/+5
* Fix for #4451 - ajax tabs error handlingJörn Zaefferer2010-02-244-2/+21
* Datepicker: Fixed #5156 Added Chinese Hong Kong localisationKeith Wood2010-02-222-0/+3
* use button on accordion demo page with a button-eleementJörn Zaefferer2010-02-201-1/+2
* partial for #5126 - less rows in remote demo to avoid scrollingJörn Zaefferer2010-02-201-1/+1
* partial for #5126 - improved custom data demoJörn Zaefferer2010-02-201-3/+2
* partial for #5126 - extra classes for combobox inputJörn Zaefferer2010-02-201-2/+1
* partial for #5126 - less rows in remote jsonp demo to avoid scrollingJörn Zaefferer2010-02-201-1/+1
* no delay need for local dataJörn Zaefferer2010-02-171-0/+1
* Autocomplete categories demo: Simplified styling.Scott González2010-02-171-1/+2
* Autocomplete categories demo: Removed custom jQuery methods and tweaked the c...Scott González2010-02-171-17/+3
* Autocomplete demo: Added styling to the categories.Scott González2010-02-171-2/+5
* Working categorized autocomplete demo.Scott González2010-02-171-31/+64
* Fix for #5188 along with a half-functional demo (buggy keyboard navigation)Jörn Zaefferer2010-02-161-0/+69
* Fixed #5182 - Update to jQuery 1.4.2Richard Worth2010-02-16116-116/+116
* fixed #5163 - themes: css files need to be renamed to be consistent with js f...Richard Worth2010-02-16116-117/+117
* Removed extra semicolon.Scott González2010-02-061-1/+1
* Slider demo: Don't change default values.Scott González2010-02-051-11/+9
* autocomplete: back to custom json encoding (for compat with older PHP impleme...Jörn Zaefferer2010-01-281-1/+1
* autocomplete: back to custom json encoding (for compat with older PHP impleme...Jörn Zaefferer2010-01-281-2/+2
* autocomplete: use json_encode in PHP to produce valid JSONJörn Zaefferer2010-01-281-1/+1
* switched to jQuery 1.4.1Richard Worth2010-01-27116-116/+116
* autocomplete: added xml-parsing demoJörn Zaefferer2010-01-263-0/+183
* button: more specific selectors for demo pages, avoiding any other global dem...Jörn Zaefferer2010-01-201-1/+1
* button: don't style everything, just the demoJörn Zaefferer2010-01-201-1/+1
* eol-style and mime-typeRichard Worth2010-01-2015-887/+887
* switched to jQuery 1.4Richard Worth2010-01-20115-115/+115
* Dialog, position: Removed bgiframe option; always use bgiframe when available.Scott González2010-01-196-6/+0
* Widget factory: Changed _create to _init.Scott González2010-01-151-1/+1
* Dialog: Tweaking demo so buttons fit on one line.Scott González2010-01-151-6/+1
* Replaced stackfix with bgiframe.Scott González2010-01-147-13/+13
* Copied autocomplete from dev branch.Scott González2010-01-1413-0/+1138
t/48235/stable30'>backport/48235/stable30 Nextcloud server, a safe home for all your data: https://github.com/nextcloud/serverwww-data
summaryrefslogtreecommitdiffstats
path: root/lib/private/Log/Systemdlog.php
blob: 8619cb5e4dd9af991a6c9ceb7b6a40d0de000b06 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
/**
 * @copyright Copyright (c) 2018, Johannes Ernst
 *
 * @author Christoph Wurst <christoph@winzerhof-wurst.at>
 * @author Johannes Ernst <jernst@indiecomputing.com>
 * @author Julius Härtl <jus@bitgrid.net>
 * @author Roeland Jago Douma <roeland@famdouma.nl>
 *
 * @license GNU AGPL version 3 or any later version
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 *
 */
namespace OC\Log;

use OC\SystemConfig;
use OCP\HintException;
use OCP\ILogger;
use OCP\Log\IWriter;

// The following fields are understood by systemd/journald, see
// man systemd.journal-fields. All are optional:
// MESSAGE=
//     The human-readable message string for this entry.
// MESSAGE_ID=
//     A 128-bit message identifier ID
// PRIORITY=
//     A priority value between 0 ("emerg") and 7 ("debug")
// CODE_FILE=, CODE_LINE=, CODE_FUNC=
//     The code location generating this message, if known
// ERRNO=
//     The low-level Unix error number causing this entry, if any.
// SYSLOG_FACILITY=, SYSLOG_IDENTIFIER=, SYSLOG_PID=
//     Syslog compatibility fields

class Systemdlog extends LogDetails implements IWriter {
	protected $levels = [
		ILogger::DEBUG => 7,
		ILogger::INFO => 6,
		ILogger::WARN => 4,
		ILogger::ERROR => 3,
		ILogger::FATAL => 2,
	];

	protected $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 $app
	 * @param string|array $message
	 * @param int $level
	 */
	public function write(string $app, $message, int $level) {
		$journal_level = $this->levels[$level];
		sd_journal_send('PRIORITY='.$journal_level,
			'SYSLOG_IDENTIFIER='.$this->syslogId,
			'MESSAGE=' . $this->logDetailsAsJSON($app, $message, $level));
	}
}