Skip to content
Snippets Groups Projects
Commit dd9facac authored by Jaime Perez Crespo's avatar Jaime Perez Crespo
Browse files

Move the SimpleSAML_Logger class to SimpleSAML\Logger.

parent 2c050ee9
Branches
Tags
No related merge requests found
<?php
namespace SimpleSAML;
/**
* The main logger class for SimpleSAMLphp.
......@@ -10,11 +12,11 @@
* @package SimpleSAMLphp
* @version $ID$
*/
class SimpleSAML_Logger
class Logger
{
/**
* @var SimpleSAML_Logger_LoggingHandler|false|null
* @var \SimpleSAML_Logger_LoggingHandler|false|null
*/
private static $loggingHandler = null;
......@@ -264,7 +266,7 @@ class SimpleSAML_Logger
*/
public static function flush()
{
$s = SimpleSAML_Session::getSessionFromRequest();
$s = \SimpleSAML_Session::getSessionFromRequest();
self::$trackid = $s->getTrackID();
self::$shuttingDown = true;
......@@ -333,7 +335,7 @@ class SimpleSAML_Logger
// register a shutdown handler if needed
if (!self::$shutdownRegistered) {
register_shutdown_function(array('SimpleSAML_Logger', 'flush'));
register_shutdown_function(array('SimpleSAML\Logger', 'flush'));
self::$shutdownRegistered = true;
}
}
......@@ -344,8 +346,8 @@ class SimpleSAML_Logger
self::$loggingHandler = false;
// get the configuration
$config = SimpleSAML_Configuration::getInstance();
assert($config instanceof SimpleSAML_Configuration);
$config = \SimpleSAML_Configuration::getInstance();
assert($config instanceof \SimpleSAML_Configuration);
// get the metadata handler option from the configuration
$handler = $config->getString('logging.handler', 'syslog');
......@@ -356,13 +358,13 @@ class SimpleSAML_Logger
$handler = strtolower($handler);
if ($handler === 'syslog') {
$sh = new SimpleSAML_Logger_LoggingHandlerSyslog();
$sh = new \SimpleSAML_Logger_LoggingHandlerSyslog();
} elseif ($handler === 'file') {
$sh = new SimpleSAML_Logger_LoggingHandlerFile();
$sh = new \SimpleSAML_Logger_LoggingHandlerFile();
} elseif ($handler === 'errorlog') {
$sh = new SimpleSAML_Logger_LoggingHandlerErrorLog();
$sh = new \SimpleSAML_Logger_LoggingHandlerErrorLog();
} else {
throw new Exception(
throw new \Exception(
'Invalid value for the [logging.handler] configuration option. Unknown handler: '.$handler
);
}
......
......@@ -1042,7 +1042,7 @@ class SimpleSAML_Metadata_SAMLParser
// Registration Authority cannot be overridden (warn only if override attempts to change the value)
if (isset($ret['RegistrationInfo']['registrationAuthority'])
&& $ret['RegistrationInfo']['registrationAuthority'] !== $e->registrationAuthority) {
SimpleSAML_Logger::warning('Invalid attempt to override registrationAuthority \''
SimpleSAML\Logger::warning('Invalid attempt to override registrationAuthority \''
. $ret['RegistrationInfo']['registrationAuthority'] . "' with '{$e->registrationAuthority}'");
} else {
$ret['RegistrationInfo']['registrationAuthority'] = $e->registrationAuthority;
......@@ -1465,7 +1465,7 @@ class SimpleSAML_Metadata_SAMLParser
}
}
}
SimpleSAML_Logger::debug('Could not validate signature');
SimpleSAML\Logger::debug('Could not validate signature');
return false;
}
......@@ -1496,7 +1496,7 @@ class SimpleSAML_Metadata_SAMLParser
}
}
}
SimpleSAML_Logger::debug('Fingerprint was ['.$fingerprint.'] not one of ['.join(', ', $candidates).']');
SimpleSAML\Logger::debug('Fingerprint was ['.$fingerprint.'] not one of ['.join(', ', $candidates).']');
return false;
}
}
......@@ -26,7 +26,7 @@ function temporaryLoader($class)
$path = explode('_', $class);
$new = join('\\', $path);
if (class_exists($new, false)) {
SimpleSAML_Logger::warning("The class '$class' is now using namespaces, please use '$new'.");
SimpleSAML\Logger::warning("The class '$class' is now using namespaces, please use '$new'.");
class_alias($new, $class);
}
......
......@@ -50,7 +50,7 @@ set_exception_handler('SimpleSAML_exception_handler');
// log full backtrace on errors and warnings
function SimpleSAML_error_handler($errno, $errstr, $errfile = null, $errline = 0, $errcontext = null)
{
if (!class_exists('SimpleSAML_Logger')) {
if (!class_exists('SimpleSAML\Logger')) {
/* We are probably logging a deprecation-warning during parsing. Unfortunately, the autoloader is disabled at
* this point, so we should stop here.
*
......@@ -59,7 +59,7 @@ function SimpleSAML_error_handler($errno, $errstr, $errfile = null, $errline = 0
return false;
}
if (SimpleSAML_Logger::isErrorMasked($errno)) {
if (SimpleSAML\Logger::isErrorMasked($errno)) {
// masked error
return false;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment