ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
SimpleSAML\Logger\SyslogLoggingHandler Class Reference
+ Inheritance diagram for SimpleSAML\Logger\SyslogLoggingHandler:
+ Collaboration diagram for SimpleSAML\Logger\SyslogLoggingHandler:

Public Member Functions

 __construct (\SimpleSAML_Configuration $config)
 Build a new logging handler based on syslog. More...
 
 setLogFormat ($format)
 Set the format desired for the logs. More...
 
 log ($level, $string)
 Log a message to syslog. More...
 

Private Attributes

 $isWindows = false
 
 $format
 

Detailed Description

Definition at line 14 of file SyslogLoggingHandler.php.

Constructor & Destructor Documentation

◆ __construct()

SimpleSAML\Logger\SyslogLoggingHandler::__construct ( \SimpleSAML_Configuration  $config)

Build a new logging handler based on syslog.

Implements SimpleSAML\Logger\LoggingHandlerInterface.

Definition at line 23 of file SyslogLoggingHandler.php.

References defined, SimpleSAML_Configuration\getInteger(), and SimpleSAML_Configuration\getString().

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  }
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27
+ Here is the call graph for this function:

Member Function Documentation

◆ log()

SimpleSAML\Logger\SyslogLoggingHandler::log (   $level,
  $string 
)

Log a message to syslog.

Parameters
int$levelThe log level.
string$stringThe formatted message to log.

Implements SimpleSAML\Logger\LoggingHandlerInterface.

Definition at line 56 of file SyslogLoggingHandler.php.

References $formats, and array.

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  }
Create styles array
The data for the language used.
$formats
Definition: date.php:77

◆ setLogFormat()

SimpleSAML\Logger\SyslogLoggingHandler::setLogFormat (   $format)

Set the format desired for the logs.

Parameters
string$formatThe format used for logs.

Implements SimpleSAML\Logger\LoggingHandlerInterface.

Definition at line 44 of file SyslogLoggingHandler.php.

References SimpleSAML\Logger\SyslogLoggingHandler\$format, and format.

45  {
46  $this->format = $format;
47  }
Write to Excel2007 format

Field Documentation

◆ $format

SimpleSAML\Logger\SyslogLoggingHandler::$format
private

◆ $isWindows

SimpleSAML\Logger\SyslogLoggingHandler::$isWindows = false
private

Definition at line 16 of file SyslogLoggingHandler.php.


The documentation for this class was generated from the following file: