4 include_once
'./libs/composer/vendor/autoload.php';
5 include_once
'./Services/Logging/classes/public/class.ilLogLevel.php';
29 const DEFAULT_FORMAT =
"[%suid%] [%datetime%] %channel%.%level_name%: %message% %context% %extra%\n";
55 if(!static::$instance)
57 include_once
'./Services/Logging/classes/class.ilLoggingDBSettings.php';
61 return static::$instance;
71 return static::$instance =
new self(
$settings);
84 $factory = self::getInstance();
85 return $factory->getComponentLogger($a_component_id);
94 $factory = self::getInstance();
95 return $factory->getComponentLogger(self::ROOT_LOGGER);
106 if(!$this->
getSettings()->isBrowserLogEnabledForUser($a_login))
111 include_once(
"./Services/Logging/classes/extensions/class.ilLineFormatter.php");
113 foreach($this->loggers as $a_component_id => $logger)
118 $browser_handler->setLevel($this->
getSettings()->getLevelByComponent($a_component_id));
119 $browser_handler->setFormatter(
new ilLineFormatter(static::DEFAULT_FORMAT,
'Y-m-d H:i:s.u',TRUE,TRUE));
120 $logger->getLogger()->pushHandler($browser_handler);
131 include_once
'./Services/Context/classes/class.ilContext.php';
136 if (isset(
$_GET[
"cmdMode"]) &&
$_GET[
"cmdMode"] ==
"asynch")
168 if(isset($this->loggers[$a_component_id]))
170 return $this->loggers[$a_component_id];
173 switch($a_component_id)
176 $logger =
new Logger(CLIENT_ID.
'_root');
180 $logger =
new Logger(CLIENT_ID.
'_'.$a_component_id);
188 $logger->pushHandler($null_handler);
190 include_once
'./Services/Logging/classes/class.ilComponentLogger.php';
201 if($a_component_id == self::ROOT_LOGGER)
203 $stream_handler->setLevel($this->
getSettings()->getLevelByComponent(self::COMPONENT_ROOT));
207 $stream_handler->setLevel($this->
getSettings()->getLevelByComponent($a_component_id));
211 include_once(
"./Services/Logging/classes/extensions/class.ilLineFormatter.php");
212 $line_formatter =
new ilLineFormatter(static::DEFAULT_FORMAT,
'Y-m-d H:i:s.u',TRUE,TRUE);
213 $stream_handler->setFormatter($line_formatter);
223 $logger->pushHandler($finger_crossed_handler);
227 $logger->pushHandler($stream_handler);
237 #$browser_handler->setLevel($this->getSettings()->getLevelByComponent($a_component_id)); 238 $browser_handler->setLevel($this->
getSettings()->getLevel());
239 $browser_handler->setFormatter($line_formatter);
240 $logger->pushHandler($browser_handler);
247 $logger->pushProcessor(
function ($record) {
248 $record[
'suid'] = substr(session_id(),0,5);
253 include_once
'./Services/Logging/classes/extensions/class.ilTraceProcessor.php';
258 include_once
'./Services/Logging/classes/class.ilComponentLogger.php';
261 return $this->loggers[$a_component_id];
Buffers all records until a certain level is reached.
getSettings()
Get settigns.
static newInstance(ilLoggingSettings $settings)
get new instance
Error level based activation strategy.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
Component logger with individual log levels by component id.
initUser($a_login)
Init user specific log options.
Handler sending logs to browser's javascript console with no browser extension required.
isConsoleAvailable()
Check if console handler is available.
getComponentLogger($a_component_id)
Get component logger.
Create styles array
The data for the language used.
static getInstance()
Get instance.
Stores to any stream resource.
static getLogger($a_component_id)
Get component logger.
__construct(ilLoggingSettings $settings)
static getType()
Get context type.
static getRootLogger()
The unique root logger has a fixed error level.