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

Public Member Functions

 __construct (\SimpleSAML_Configuration $config)
 ErrorLogLoggingHandler constructor. More...
 
 setLogFormat ($format)
 Set the format desired for the logs. More...
 
 log ($level, $string)
 Log a message to syslog. More...
 

Private Attributes

 $processname
 

Static Private Attributes

static $levelNames
 This array contains the mappings from syslog log level to names. More...
 

Detailed Description

Definition at line 15 of file ErrorLogLoggingHandler.php.

Constructor & Destructor Documentation

◆ __construct()

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

ErrorLogLoggingHandler constructor.

Parameters
\SimpleSAML_Configuration$configThe configuration object for this handler.

Implements SimpleSAML\Logger\LoggingHandlerInterface.

Definition at line 45 of file ErrorLogLoggingHandler.php.

References SimpleSAML_Configuration\getString().

46  {
47  $this->processname = $config->getString('logging.processname', 'SimpleSAMLphp');
48  }
+ Here is the call graph for this function:

Member Function Documentation

◆ log()

SimpleSAML\Logger\ErrorLogLoggingHandler::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 68 of file ErrorLogLoggingHandler.php.

References $formats, array, and Monolog\Handler\error_log().

69  {
70  if (array_key_exists($level, self::$levelNames)) {
71  $levelName = self::$levelNames[$level];
72  } else {
73  $levelName = sprintf('UNKNOWN%d', $level);
74  }
75 
76  $formats = array('%process', '%level');
77  $replacements = array($this->processname, $levelName);
78  $string = str_replace($formats, $replacements, $string);
79  $string = preg_replace('/%\w+(\{[^\}]+\})?/', '', $string);
80  $string = trim($string);
81 
82  error_log($string);
83  }
Create styles array
The data for the language used.
$formats
Definition: date.php:77
+ Here is the call graph for this function:

◆ setLogFormat()

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

Set the format desired for the logs.

Parameters
string$formatThe format used for logs.

Implements SimpleSAML\Logger\LoggingHandlerInterface.

Definition at line 56 of file ErrorLogLoggingHandler.php.

57  {
58  // we don't need the format here
59  }

Field Documentation

◆ $levelNames

SimpleSAML\Logger\ErrorLogLoggingHandler::$levelNames
staticprivate
Initial value:
Logger::EMERG => 'EMERG',
Logger::ALERT => 'ALERT',
Logger::CRIT => 'CRIT',
Logger::ERR => 'ERR',
Logger::WARNING => 'WARNING',
Logger::NOTICE => 'NOTICE',
Logger::INFO => 'INFO',
Logger::DEBUG => 'DEBUG',
)

This array contains the mappings from syslog log level to names.

Definition at line 21 of file ErrorLogLoggingHandler.php.

◆ $processname

SimpleSAML\Logger\ErrorLogLoggingHandler::$processname
private

Definition at line 37 of file ErrorLogLoggingHandler.php.


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