diff options
Diffstat (limited to 'lib/SimpleSAML/Logger/LoggingHandlerErrorLog.php')
-rw-r--r-- | lib/SimpleSAML/Logger/LoggingHandlerErrorLog.php | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/lib/SimpleSAML/Logger/LoggingHandlerErrorLog.php b/lib/SimpleSAML/Logger/LoggingHandlerErrorLog.php index 0a687ee..cd9404d 100644 --- a/lib/SimpleSAML/Logger/LoggingHandlerErrorLog.php +++ b/lib/SimpleSAML/Logger/LoggingHandlerErrorLog.php @@ -26,18 +26,29 @@ class SimpleSAML_Logger_LoggingHandlerErrorLog implements SimpleSAML_Logger_Logg ); - function log_internal($level, $string) {
- $config = SimpleSAML_Configuration::getInstance();
- assert($config instanceof SimpleSAML_Configuration);
- $processname = $config->getString('logging.processname','simpleSAMLphp');
-
+ function setLogFormat($format) { + $this->format = $format; + } + + + function log_internal($level, $string) { + $config = SimpleSAML_Configuration::getInstance(); + assert($config instanceof SimpleSAML_Configuration); + $processname = $config->getString('logging.processname','simpleSAMLphp'); + if(array_key_exists($level, self::$levelNames)) { $levelName = self::$levelNames[$level]; } else { $levelName = sprintf('UNKNOWN%d', $level); } - error_log($processname.' - '.$levelName . ': ' . $string); + $formats = array('%process', '%level'); + $replacements = array($processname, $levelName); + $string = str_replace($formats, $replacements, $string); + $string = preg_replace('/%\w+(\{[^\}]+\})?/', '', $string); + $string = trim($string); + + error_log($string); } } |