4 include_once
'./libs/composer/vendor/autoload.php';
5 include_once
'./Services/Logging/classes/public/class.ilLogLevel.php';
23 const DEFAULT_FORMAT =
"[%suid%] [%datetime%] %channel%.%level_name%: %message% %context% %extra%\n";
48 if (!static::$instance) {
49 include_once
'./Services/Logging/classes/class.ilLoggingDBSettings.php';
53 return static::$instance;
63 return static::$instance =
new self(
$settings);
77 return $factory->getComponentLogger($a_component_id);
87 return $factory->getComponentLogger(self::ROOT_LOGGER);
98 if (!$this->
getSettings()->isBrowserLogEnabledForUser($a_login)) {
102 include_once(
"./Services/Logging/classes/extensions/class.ilLineFormatter.php");
104 foreach ($this->loggers as $a_component_id => $logger) {
107 $browser_handler->setLevel($this->
getSettings()->getLevelByComponent($a_component_id));
108 $browser_handler->setFormatter(
new ilLineFormatter(static::DEFAULT_FORMAT,
'Y-m-d H:i:s.u',
true,
true));
109 $logger->getLogger()->pushHandler($browser_handler);
120 include_once
'./Services/Context/classes/class.ilContext.php';
124 if (isset(
$_GET[
"cmdMode"]) &&
$_GET[
"cmdMode"] ==
"asynch") {
155 if (isset($this->loggers[$a_component_id])) {
156 return $this->loggers[$a_component_id];
159 $loggerNamePrefix =
'';
160 if (defined(
'CLIENT_ID')) {
161 $loggerNamePrefix = CLIENT_ID .
'_';
164 switch ($a_component_id) {
166 $logger =
new Logger($loggerNamePrefix .
'root');
170 $logger =
new Logger($loggerNamePrefix . $a_component_id);
177 $logger->pushHandler($null_handler);
179 include_once
'./Services/Logging/classes/class.ilComponentLogger.php';
190 if ($a_component_id == self::ROOT_LOGGER) {
191 $stream_handler->setLevel($this->
getSettings()->getLevelByComponent(self::COMPONENT_ROOT));
193 $stream_handler->setLevel($this->
getSettings()->getLevelByComponent($a_component_id));
197 include_once(
"./Services/Logging/classes/extensions/class.ilLineFormatter.php");
198 $line_formatter =
new ilLineFormatter(static::DEFAULT_FORMAT,
'Y-m-d H:i:s.u',
true,
true);
199 $stream_handler->setFormatter($line_formatter);
208 $logger->pushHandler($finger_crossed_handler);
210 $logger->pushHandler($stream_handler);
214 $GLOBALS[
'DIC']->offsetExists(
'ilUser') &&
220 #$browser_handler->setLevel($this->getSettings()->getLevelByComponent($a_component_id)); 221 $browser_handler->setLevel($this->
getSettings()->getLevel());
222 $browser_handler->setFormatter($line_formatter);
223 $logger->pushHandler($browser_handler);
230 $logger->pushProcessor(
function ($record) {
231 $record[
'suid'] = substr(session_id(), 0, 5);
236 include_once
'./Services/Logging/classes/extensions/class.ilTraceProcessor.php';
241 include_once
'./Services/Logging/classes/class.ilComponentLogger.php';
244 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.
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.
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.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
static getRootLogger()
The unique root logger has a fixed error level.