summaryrefslogtreecommitdiffstats
path: root/lib/SimpleSAML/Logger/LoggingHandlerErrorLog.php
diff options
context:
space:
mode:
authorJaime Perez Crespo <jaime.perez@uninett.no>2016-04-01 16:11:07 +0200
committerJaime Perez Crespo <jaime.perez@uninett.no>2016-04-01 16:11:07 +0200
commited884a147df25e7edc00ff7ede59c3adb763ca14 (patch)
tree36275787c27a6d8229bcc3bedbe602f608290933 /lib/SimpleSAML/Logger/LoggingHandlerErrorLog.php
parent1d5b596ab432dc3db2351d3f67743fcbe16dbfeb (diff)
downloadsimplesamlphp-ed884a147df25e7edc00ff7ede59c3adb763ca14.zip
simplesamlphp-ed884a147df25e7edc00ff7ede59c3adb763ca14.tar.gz
simplesamlphp-ed884a147df25e7edc00ff7ede59c3adb763ca14.tar.bz2
Migrate all the logging handlers to namespaces. Make SimpleSAML\Logger a bit more intelligent so that it allows using custom logging handlers. Now you just need to implement SimpleSAML\Logger\LogginghandlerInterface in a class, and set the 'logging.handler' option in the configuration file to a string with the full name of your class.
Diffstat (limited to 'lib/SimpleSAML/Logger/LoggingHandlerErrorLog.php')
-rw-r--r--lib/SimpleSAML/Logger/LoggingHandlerErrorLog.php68
1 files changed, 0 insertions, 68 deletions
diff --git a/lib/SimpleSAML/Logger/LoggingHandlerErrorLog.php b/lib/SimpleSAML/Logger/LoggingHandlerErrorLog.php
deleted file mode 100644
index 119027a..0000000
--- a/lib/SimpleSAML/Logger/LoggingHandlerErrorLog.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-
-/**
- * A class for logging to the default php error log.
- *
- * @author Lasse Birnbaum Jensen, SDU.
- * @author Andreas Åkre Solberg, UNINETT AS. <andreas.solberg@uninett.no>
- * @author Olav Morken, UNINETT AS.
- * @package SimpleSAMLphp
- * @version $ID$
- */
-class SimpleSAML_Logger_LoggingHandlerErrorLog implements SimpleSAML_Logger_LoggingHandler
-{
-
- /**
- * This array contains the mappings from syslog loglevel to names.
- */
- private static $levelNames = array(
- 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',
- );
- private $format;
-
-
- /**
- * Set the format desired for the logs.
- *
- * @param string $format The format used for logs.
- */
- public function setLogFormat($format)
- {
- $this->format = $format;
- }
-
-
- /**
- * Log a message to syslog.
- *
- * @param int $level The log level.
- * @param string $string The formatted message to log.
- */
- public function log($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);
- }
-
- $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);
- }
-}