diff --git a/config-templates/config.php b/config-templates/config.php index 243d3d150ab11364cfc50b3922a17e14328edc98..a4cdb0f6c5191e59a1ceaf782ba6cfe0a6fb5252 100644 --- a/config-templates/config.php +++ b/config-templates/config.php @@ -104,18 +104,18 @@ $config = array ( * Logging. * * define the minimum log level to log - * LOG_ERR No statistics, only errors - * LOG_WARNING No statistics, only warnings/errors - * LOG_NOTICE Statistics and errors - * LOG_INFO Verbose logs - * LOG_DEBUG Full debug logs - not reccomended for production + * SimpleSAML_Logger::ERR No statistics, only errors + * SimpleSAML_Logger::WARNING No statistics, only warnings/errors + * SimpleSAML_Logger::NOTICE Statistics and errors + * SimpleSAML_Logger::INFO Verbose logs + * SimpleSAML_Logger::DEBUG Full debug logs - not reccomended for production * * Choose logging handler. * * Options: [syslog,file,errorlog] * */ - 'logging.level' => LOG_NOTICE, + 'logging.level' => SimpleSAML_Logger::NOTICE, 'logging.handler' => 'syslog', /* diff --git a/lib/SimpleSAML/Logger.php b/lib/SimpleSAML/Logger.php index ea7a72777cb886a48344e4f41ed8c9d5f3beac71..01334f842a8b0b9d5d4f6e662dd4ebd12f71e75f 100644 --- a/lib/SimpleSAML/Logger.php +++ b/lib/SimpleSAML/Logger.php @@ -50,25 +50,33 @@ class SimpleSAML_Logger { * LOG_DEBUG Full debug logs - not reccomended for production */ + const EMERG = 0; + const ALERT = 1; + const CRIT = 2; + const ERR = 3; + const WARNING = 4; + const NOTICE = 5; + const INFO = 6; + const DEBUG = 7; static function emergency($string) { - self::log_internal(LOG_EMERG,$string); + self::log_internal(self::EMERG,$string); } static function critical($string) { - self::log_internal(LOG_CRIT,$string); + self::log_internal(self::CRIT,$string); } static function alert($string) { - self::log_internal(LOG_ALERT,$string); + self::log_internal(self::ALERT,$string); } static function error($string) { - self::log_internal(LOG_ERR,$string); + self::log_internal(self::ERR,$string); } static function warning($string) { - self::log_internal(LOG_WARNING,$string); + self::log_internal(self::WARNING,$string); } /** @@ -76,7 +84,7 @@ class SimpleSAML_Logger { * this level for other kind of log messages. */ static function notice($string) { - self::log_internal(LOG_NOTICE,$string); + self::log_internal(self::NOTICE,$string); } /** @@ -84,7 +92,7 @@ class SimpleSAML_Logger { * for tracing a session. */ static function info($string) { - self::log_internal(LOG_INFO,$string); + self::log_internal(self::INFO,$string); } /** @@ -92,14 +100,14 @@ class SimpleSAML_Logger { * what is neccessary for a production system. */ static function debug($string) { - self::log_internal(LOG_DEBUG,$string); + self::log_internal(self::DEBUG,$string); } /** * Statisitics */ static function stats($string) { - self::log_internal(LOG_NOTICE,$string,true); + self::log_internal(self::NOTICE,$string,true); } @@ -119,7 +127,7 @@ class SimpleSAML_Logger { /* * setting minimum log_level */ - self::$logLevel = $config->getInteger('logging.level',LOG_INFO); + self::$logLevel = $config->getInteger('logging.level',self::INFO); $handler = strtolower($handler); diff --git a/lib/SimpleSAML/Logger/LoggingHandlerErrorLog.php b/lib/SimpleSAML/Logger/LoggingHandlerErrorLog.php index 7b50c488bbe02db5cef4a78405e155957a2c7db9..0a687ee878bc4f5ed701ba74933cbb0b78ebfbdc 100644 --- a/lib/SimpleSAML/Logger/LoggingHandlerErrorLog.php +++ b/lib/SimpleSAML/Logger/LoggingHandlerErrorLog.php @@ -15,14 +15,14 @@ class SimpleSAML_Logger_LoggingHandlerErrorLog implements SimpleSAML_Logger_Logg * This array contains the mappings from syslog loglevel to names. */ private static $levelNames = array( - LOG_EMERG => 'EMERG', - LOG_ALERT => 'ALERT', - LOG_CRIT => 'CRIT', - LOG_ERR => 'ERR', - LOG_WARNING => 'WARNING', - LOG_NOTICE => 'NOTICE', - LOG_INFO => 'INFO', - LOG_DEBUG => 'DEBUG', + SimpleSAML_Logger::EMERG => 'EMERG', + SimpleSAML_Logger::ALERT => 'ALERT', + SimpleSAML_Logger::CRIT => 'CRIT', + SimpleSAML_Logger::ERR => 'ERR', + SimpleSAML_Logger::WARNING => 'WARNING', + SimpleSAML_Logger::NOTICE => 'NOTICE', + SimpleSAML_Logger::INFO => 'INFO', + SimpleSAML_Logger::DEBUG => 'DEBUG', ); diff --git a/lib/SimpleSAML/Logger/LoggingHandlerFile.php b/lib/SimpleSAML/Logger/LoggingHandlerFile.php index 4cc70f428d1e2224a3d8297f9381f8234f8caad5..43ed5fb16409ddee8507792ebed4d196d7ddcb54 100644 --- a/lib/SimpleSAML/Logger/LoggingHandlerFile.php +++ b/lib/SimpleSAML/Logger/LoggingHandlerFile.php @@ -16,14 +16,14 @@ class SimpleSAML_Logger_LoggingHandlerFile implements SimpleSAML_Logger_LoggingH * more or less directly from SimpleSAML_Logger_LoggingHandlerErrorLog. */ private static $levelNames = array( - LOG_EMERG => 'EMERGENCY', - LOG_ALERT => 'ALERT', - LOG_CRIT => 'CRITICAL', - LOG_ERR => 'ERROR', - LOG_WARNING => 'WARNING', - LOG_NOTICE => 'NOTICE', - LOG_INFO => 'INFO', - LOG_DEBUG => 'DEBUG', + SimpleSAML_Logger::EMERG => 'EMERGENCY', + SimpleSAML_Logger::ALERT => 'ALERT', + SimpleSAML_Logger::CRIT => 'CRITICAL', + SimpleSAML_Logger::ERR => 'ERROR', + SimpleSAML_Logger::WARNING => 'WARNING', + SimpleSAML_Logger::NOTICE => 'NOTICE', + SimpleSAML_Logger::INFO => 'INFO', + SimpleSAML_Logger::DEBUG => 'DEBUG', ); private $logFile = null;