ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilLogger Class Reference

Component logger with individual log levels by component id. More...

+ Inheritance diagram for ilLogger:
+ Collaboration diagram for ilLogger:

Public Member Functions

 __construct (private readonly Logger $logger)
 
 isHandling (int $level)
 Check whether current logger is handling a log level. More...
 
 log (string $message, int $level=ilLogLevel::INFO, array $context=[])
 
 dump ($value, int $level=ilLogLevel::INFO)
 
 debug (string $message, array $context=[])
 
 info (string $message, array $context=[])
 
 notice (string $message, array $context=[])
 
 warning (string $message, array $context=[])
 
 error (string $message, array $context=[])
 
 critical (string $message, array $context=[])
 
 alert (string $message, array $context=[])
 
 emergency (string $message, array $context=[])
 
 getLogger ()
 
 write (string $message, $level=ilLogLevel::INFO, array $context=[])
 write log message More...
 
 writeLanguageLog (string $topic, string $lang_key)
 Write language log. More...
 
 logStack (?int $level=null, string $message='', array $context=[])
 
 writeMemoryPeakUsage (int $level)
 Write memory peak usage Automatically called at end of script. More...
 

Detailed Description

Component logger with individual log levels by component id.

Author
Stefan Meyer

Definition at line 28 of file class.ilLogger.php.

Constructor & Destructor Documentation

◆ __construct()

ilLogger::__construct ( private readonly Logger  $logger)

Definition at line 30 of file class.ilLogger.php.

31 {
32 }

Member Function Documentation

◆ alert()

ilLogger::alert ( string  $message,
array  $context = [] 
)

Reimplemented in ILIAS\components\Logging\NullLogger.

Definition at line 84 of file class.ilLogger.php.

84 : void
85 {
86 $this->getLogger()->alert($message, $context);
87 }
$context
Definition: webdav.php:31
$message
Definition: xapiexit.php:31

References $context, and getLogger().

+ Here is the call graph for this function:

◆ critical()

ilLogger::critical ( string  $message,
array  $context = [] 
)

Reimplemented in ILIAS\components\Logging\NullLogger.

Definition at line 79 of file class.ilLogger.php.

79 : void
80 {
81 $this->getLogger()->critical($message, $context);
82 }

References $context, and getLogger().

+ Here is the call graph for this function:

◆ debug()

ilLogger::debug ( string  $message,
array  $context = [] 
)

◆ dump()

ilLogger::dump (   $value,
int  $level = ilLogLevel::INFO 
)

Reimplemented in ILIAS\components\Logging\NullLogger.

Definition at line 47 of file class.ilLogger.php.

47 : void
48 {
49 $this->log('{dump}', $level, [
50 'dump' => print_r($value, true),
51 ]);
52 }
log(string $message, int $level=ilLogLevel::INFO, array $context=[])

References log().

+ Here is the call graph for this function:

◆ emergency()

ilLogger::emergency ( string  $message,
array  $context = [] 
)

Reimplemented in ILIAS\components\Logging\NullLogger.

Definition at line 89 of file class.ilLogger.php.

89 : void
90 {
91 $this->getLogger()->emergency($message, $context);
92 }

References $context, and getLogger().

+ Here is the call graph for this function:

◆ error()

ilLogger::error ( string  $message,
array  $context = [] 
)

Reimplemented in ILIAS\components\Logging\NullLogger.

Definition at line 74 of file class.ilLogger.php.

74 : void
75 {
76 $this->getLogger()->error($message, $context);
77 }

References $context, and getLogger().

+ Here is the call graph for this function:

◆ getLogger()

ilLogger::getLogger ( )

Reimplemented in ILIAS\components\Logging\NullLogger.

Definition at line 94 of file class.ilLogger.php.

94 : Logger
95 {
96 return $this->logger;
97 }

Referenced by alert(), critical(), debug(), emergency(), error(), info(), isHandling(), log(), logStack(), notice(), warning(), write(), writeLanguageLog(), and writeMemoryPeakUsage().

+ Here is the caller graph for this function:

◆ info()

ilLogger::info ( string  $message,
array  $context = [] 
)

Reimplemented in ILIAS\components\Logging\NullLogger.

Definition at line 59 of file class.ilLogger.php.

59 : void
60 {
61 $this->getLogger()->info($message, $context);
62 }

References $context, and getLogger().

Referenced by ilLTIAppEventListener\definePercentageByObjectId(), and ilLTIAppEventListener\handleEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isHandling()

ilLogger::isHandling ( int  $level)

Check whether current logger is handling a log level.

Reimplemented in ILIAS\components\Logging\NullLogger.

Definition at line 37 of file class.ilLogger.php.

37 : bool
38 {
39 return $this->getLogger()->isHandling($level);
40 }

References getLogger().

+ Here is the call graph for this function:

◆ log()

ilLogger::log ( string  $message,
int  $level = ilLogLevel::INFO,
array  $context = [] 
)

Reimplemented in ILIAS\components\Logging\NullLogger.

Definition at line 42 of file class.ilLogger.php.

42 : void
43 {
44 $this->getLogger()->log($level, $message, $context);
45 }

References $context, $message, and getLogger().

Referenced by dump().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ logStack()

ilLogger::logStack ( ?int  $level = null,
string  $message = '',
array  $context = [] 
)

Reimplemented in ILIAS\components\Logging\NullLogger.

Definition at line 121 of file class.ilLogger.php.

121 : void
122 {
123 if (is_null($level)) {
124 $level = ilLogLevel::INFO;
125 }
126
127 if (!in_array($level, ilLogLevel::getLevels())) {
128 $level = ilLogLevel::INFO;
129 }
130
131
132 try {
133 throw new Exception($message);
134 } catch (Exception $ex) {
135 $this->getLogger()->log($level, $message . "\n" . $ex->getTraceAsString(), $context);
136 }
137 }
static getLevels()

References $context, $message, ilLogLevel\getLevels(), getLogger(), and ilLogLevel\INFO.

Referenced by ilCourseAppEventListener\awardCertificate(), ilParticipants\getInstance(), and ilParticipants\getInstanceByObjId().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ notice()

ilLogger::notice ( string  $message,
array  $context = [] 
)

Reimplemented in ILIAS\components\Logging\NullLogger.

Definition at line 64 of file class.ilLogger.php.

64 : void
65 {
66 $this->getLogger()->notice($message, $context);
67 }

References $context, and getLogger().

+ Here is the call graph for this function:

◆ warning()

ilLogger::warning ( string  $message,
array  $context = [] 
)

Reimplemented in ILIAS\components\Logging\NullLogger.

Definition at line 69 of file class.ilLogger.php.

69 : void
70 {
71 $this->getLogger()->warning($message, $context);
72 }

References $context, and getLogger().

Referenced by ilCourseAppEventListener\awardCertificate(), ilGroupAppEventListener\doAutoFill(), ilParticipants\getInstance(), ilParticipants\getInstanceByObjId(), and ilCalendarRemoteAccessHandler\handleRequest().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ write()

ilLogger::write ( string  $message,
  $level = ilLogLevel::INFO,
array  $context = [] 
)

write log message

Deprecated:
since version 5.1
See also
ilLogger->info(), ilLogger()->debug(), ...

Reimplemented in ILIAS\components\Logging\NullLogger.

Definition at line 104 of file class.ilLogger.php.

104 : void
105 {
106 if (!in_array($level, ilLogLevel::getLevels())) {
107 $level = ilLogLevel::INFO;
108 }
109 $this->getLogger()->log((int) $level, $message, $context);
110 }

References $context, $message, ilLogLevel\getLevels(), getLogger(), and ilLogLevel\INFO.

Referenced by ilQuestionPageParser\storeTree().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writeLanguageLog()

ilLogger::writeLanguageLog ( string  $topic,
string  $lang_key 
)

Write language log.

Deprecated:
since version 5.1

Reimplemented in ILIAS\components\Logging\NullLogger.

Definition at line 116 of file class.ilLogger.php.

116 : void
117 {
118 $this->getLogger()->debug("Language (" . $lang_key . "): topic -" . $topic . "- not present");
119 }

References getLogger().

Referenced by ilSetupLanguage\txt().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writeMemoryPeakUsage()

ilLogger::writeMemoryPeakUsage ( int  $level)

Write memory peak usage Automatically called at end of script.

Reimplemented in ILIAS\components\Logging\NullLogger.

Definition at line 143 of file class.ilLogger.php.

143 : void
144 {
145 $this->getLogger()->pushProcessor(new MemoryPeakUsageProcessor());
146 $this->getLogger()->log($level, 'Memory usage: ');
147 $this->getLogger()->popProcessor();
148 }

References getLogger().

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: