ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
◀ ilDoc Overview
SyslogLoggingHandler.php
Go to the documentation of this file.
1
<?
php
2
3
namespace
SimpleSAML\Logger
;
4
5
use
SimpleSAML\Utils\System
;
6
14
class
SyslogLoggingHandler
implements
LoggingHandlerInterface
15
{
16
private
$isWindows
=
false
;
17
private
$format
;
18
19
23
public
function
__construct
(\
SimpleSAML_Configuration
$config
)
24
{
25
$facility =
$config
->getInteger(
'logging.facility'
, defined(
'LOG_LOCAL5'
) ? constant(
'LOG_LOCAL5'
) : LOG_USER);
26
27
$processname =
$config
->getString(
'logging.processname'
,
'SimpleSAMLphp'
);
28
29
// Setting facility to LOG_USER (only valid in Windows), enable log level rewrite on windows systems
30
if
(
System::getOS
() ===
System::WINDOWS
) {
31
$this->isWindows =
true
;
32
$facility = LOG_USER;
33
}
34
35
openlog($processname, LOG_PID, $facility);
36
}
37
38
44
public
function
setLogFormat
(
$format
)
45
{
46
$this->format =
$format
;
47
}
48
49
56
public
function
log
($level, $string)
57
{
58
// changing log level to supported levels if OS is Windows
59
if
($this->isWindows) {
60
if
($level <= 4) {
61
$level = LOG_ERR;
62
}
else
{
63
$level = LOG_INFO;
64
}
65
}
66
67
$formats
= array(
'%process'
,
'%level'
);
68
$replacements = array(
''
, $level);
69
$string = str_replace(
$formats
, $replacements, $string);
70
$string = preg_replace(
'/%\w+(\{[^\}]+\})?/'
,
''
, $string);
71
$string = trim($string);
72
73
syslog($level, $string);
74
}
75
}
php
An exception for terminatinating execution or to throw for unit testing.
SimpleSAML\Logger\SyslogLoggingHandler
Definition:
SyslogLoggingHandler.php:15
SimpleSAML\Logger\SyslogLoggingHandler\setLogFormat
setLogFormat($format)
Set the format desired for the logs.
Definition:
SyslogLoggingHandler.php:44
SimpleSAML\Logger\SyslogLoggingHandler\__construct
__construct(\SimpleSAML_Configuration $config)
Build a new logging handler based on syslog.
Definition:
SyslogLoggingHandler.php:23
SimpleSAML\Logger\SyslogLoggingHandler\$isWindows
$isWindows
Definition:
SyslogLoggingHandler.php:16
SimpleSAML\Logger\SyslogLoggingHandler\log
log($level, $string)
Log a message to syslog.
Definition:
SyslogLoggingHandler.php:56
SimpleSAML\Logger\SyslogLoggingHandler\$format
$format
Definition:
SyslogLoggingHandler.php:17
SimpleSAML\Utils\System
Definition:
System.php:10
SimpleSAML\Utils\System\WINDOWS
const WINDOWS
Definition:
System.php:12
SimpleSAML\Utils\System\getOS
static getOS()
This function returns the Operating System we are running on.
Definition:
System.php:29
SimpleSAML_Configuration
Definition:
Configuration.php:12
$formats
$formats
Definition:
date.php:77
SimpleSAML\Logger\LoggingHandlerInterface
Definition:
LoggingHandlerInterface.php:13
$config
$config
Definition:
bootstrap.php:15
SimpleSAML\Logger
Definition:
ErrorLogLoggingHandler.php:3
libs
composer
vendor
simplesamlphp
simplesamlphp
lib
SimpleSAML
Logger
SyslogLoggingHandler.php
Generated on Thu Oct 2 2025 19:01:18 for ILIAS by
1.9.4 (using
Doxyfile
)