Skip to content
Snippets Groups Projects
Commit ad9106b3 authored by Andreas Åkre Solberg's avatar Andreas Åkre Solberg
Browse files

Add support for log capturing. used in ldapstatus module.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1344 44740490-163a-0410-bde0-09ae8108e29a
parent 3c610e39
No related branches found
No related tags found
No related merge requests found
...@@ -16,6 +16,9 @@ interface SimpleSAML_Logger_LoggingHandler { ...@@ -16,6 +16,9 @@ interface SimpleSAML_Logger_LoggingHandler {
class SimpleSAML_Logger { class SimpleSAML_Logger {
private static $loggingHandler = null; private static $loggingHandler = null;
private static $logLevel = null; private static $logLevel = null;
private static $captureLog = FALSE;
private static $capturedLog = array();
/** /**
* This constant defines the string we set the trackid to while we are fetching the * This constant defines the string we set the trackid to while we are fetching the
...@@ -137,10 +140,20 @@ class SimpleSAML_Logger { ...@@ -137,10 +140,20 @@ class SimpleSAML_Logger {
self::$loggingHandler = $sh; self::$loggingHandler = $sh;
} }
public static function setCaptureLog($val = TRUE) {
self::$captureLog = $val;
}
public static function getCapturedLog() {
return self::$capturedLog;
}
static function log_internal($level,$string,$statsLog = false) { static function log_internal($level,$string,$statsLog = false) {
if (self::$loggingHandler == null) if (self::$loggingHandler == null)
self::createLoggingHandler(); self::createLoggingHandler();
if (self::$captureLog) self::$capturedLog[] = $string;
if (self::$logLevel >= $level || $statsLog) { if (self::$logLevel >= $level || $statsLog) {
if (is_array($string)) $string = implode(",",$string); if (is_array($string)) $string = implode(",",$string);
$string = '['.self::getTrackId().'] '.$string; $string = '['.self::getTrackId().'] '.$string;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment