ILIAS  release_8 Revision v8.24
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 (Logger $logger)
 
 isHandling (int $a_level)
 Check whether current logger is handling a log level. More...
 
 log (string $a_message, int $a_level=ilLogLevel::INFO)
 
 dump ($a_variable, int $a_level=ilLogLevel::INFO)
 
 debug (string $a_message, array $a_context=array())
 
 info (string $a_message)
 
 notice (string $a_message)
 
 warning (string $a_message)
 
 error (string $a_message)
 
 critical (string $a_message)
 
 alert (string $a_message)
 
 emergency (string $a_message)
 
 getLogger ()
 
 write (string $a_message, $a_level=ilLogLevel::INFO)
 write log message More...
 
 writeLanguageLog (string $a_topic, string $a_lang_key)
 Write language log. More...
 
 logStack (?int $a_level=null, string $a_message='')
 
 writeMemoryPeakUsage (int $a_level)
 Write memory peak usage Automatically called at end of script. More...
 

Private Attributes

Logger $logger
 

Detailed Description

Component logger with individual log levels by component id.

Author
Stefan Meyer

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

Constructor & Destructor Documentation

◆ __construct()

ilLogger::__construct ( Logger  $logger)

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

21 {
22 $this->logger = $logger;
23 }
Logger $logger

References $logger, and ILIAS\Repository\logger().

+ Here is the call graph for this function:

Member Function Documentation

◆ alert()

ilLogger::alert ( string  $a_message)

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

78 : void
79 {
80 $this->getLogger()->alert($a_message);
81 }

References getLogger().

+ Here is the call graph for this function:

◆ critical()

ilLogger::critical ( string  $a_message)

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

73 : void
74 {
75 $this->getLogger()->critical($a_message);
76 }

References getLogger().

+ Here is the call graph for this function:

◆ debug()

ilLogger::debug ( string  $a_message,
array  $a_context = array() 
)

Reimplemented in ilSystemStyleRootLoggerMock.

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

48 : void
49 {
50 $this->getLogger()->debug($a_message, $a_context);
51 }

References getLogger().

Referenced by ilForumAppEventListener\delegateNotification(), ilExportContainer\exportObject(), ilLTIAppEventListener\handleEvent(), ilLTIAppEventListener\handleOutcomeWithoutLP(), ilTermsOfServiceHelper\hasToResignAcceptance(), ilAuthFrontendCredentialsLTI\initFromRequest(), and ilForumAppEventListener\sendNotification().

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

◆ dump()

ilLogger::dump (   $a_variable,
int  $a_level = ilLogLevel::INFO 
)
Parameters
mixed$a_variable
int$a_level
Returns
void

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

43 : void
44 {
45 $this->log((string) print_r($a_variable, true), $a_level);
46 }
log(string $a_message, int $a_level=ilLogLevel::INFO)

References log().

+ Here is the call graph for this function:

◆ emergency()

ilLogger::emergency ( string  $a_message)

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

84 : void
85 {
86 $this->getLogger()->emergency($a_message);
87 }

References getLogger().

+ Here is the call graph for this function:

◆ error()

ilLogger::error ( string  $a_message)

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

68 : void
69 {
70 $this->getLogger()->error($a_message);
71 }

References getLogger().

Referenced by ilRandom\int().

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

◆ getLogger()

ilLogger::getLogger ( )

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

89 : Logger
90 {
91 return $this->logger;
92 }

References $logger.

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  $a_message)

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

53 : void
54 {
55 $this->getLogger()->info($a_message);
56 }

References getLogger().

+ Here is the call graph for this function:

◆ isHandling()

ilLogger::isHandling ( int  $a_level)

Check whether current logger is handling a log level.

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

28 : bool
29 {
30 return $this->getLogger()->isHandling($a_level);
31 }

References getLogger().

+ Here is the call graph for this function:

◆ log()

ilLogger::log ( string  $a_message,
int  $a_level = ilLogLevel::INFO 
)

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

33 : void
34 {
35 $this->getLogger()->log($a_level, $a_message);
36 }

References getLogger().

Referenced by dump().

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

◆ logStack()

ilLogger::logStack ( ?int  $a_level = null,
string  $a_message = '' 
)

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

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

References ilLogLevel\getLevels(), getLogger(), and ilLogLevel\INFO.

Referenced by ilParticipants\getInstance(), ilParticipants\getInstanceByObjId(), and ilRandom\int().

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

◆ notice()

ilLogger::notice ( string  $a_message)

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

58 : void
59 {
60 $this->getLogger()->notice($a_message);
61 }

References getLogger().

+ Here is the call graph for this function:

◆ warning()

ilLogger::warning ( string  $a_message)

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

63 : void
64 {
65 $this->getLogger()->warning($a_message);
66 }

References getLogger().

Referenced by 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  $a_message,
  $a_level = ilLogLevel::INFO 
)

write log message

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

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

101 : void
102 {
103 if (!in_array($a_level, ilLogLevel::getLevels())) {
104 $a_level = ilLogLevel::INFO;
105 }
106 $this->getLogger()->log((int) $a_level, $a_message);
107 }

References 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  $a_topic,
string  $a_lang_key 
)

Write language log.

Deprecated:
since version 5.1

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

113 : void
114 {
115 $this->getLogger()->debug("Language (" . $a_lang_key . "): topic -" . $a_topic . "- not present");
116 }

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  $a_level)

Write memory peak usage Automatically called at end of script.

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

140 : void
141 {
142 $this->getLogger()->pushProcessor(new MemoryPeakUsageProcessor());
143 $this->getLogger()->log($a_level, 'Memory usage: ');
144 $this->getLogger()->popProcessor();
145 }

References getLogger().

+ Here is the call graph for this function:

Field Documentation

◆ $logger

Logger ilLogger::$logger
private

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

Referenced by __construct(), and getLogger().


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