ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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.

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

21  {
22  $this->logger = $logger;
23  }
Logger $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.

References getLogger().

78  : void
79  {
80  $this->getLogger()->alert($a_message);
81  }
+ Here is the call graph for this function:

◆ critical()

ilLogger::critical ( string  $a_message)

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

References getLogger().

73  : void
74  {
75  $this->getLogger()->critical($a_message);
76  }
+ Here is the call graph for this function:

◆ debug()

◆ 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.

References log().

43  : void
44  {
45  $this->log((string) print_r($a_variable, true), $a_level);
46  }
log(string $a_message, int $a_level=ilLogLevel::INFO)
+ Here is the call graph for this function:

◆ emergency()

ilLogger::emergency ( string  $a_message)

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

References getLogger().

84  : void
85  {
86  $this->getLogger()->emergency($a_message);
87  }
+ Here is the call graph for this function:

◆ error()

ilLogger::error ( string  $a_message)

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

References getLogger().

Referenced by ilRandom\int().

68  : void
69  {
70  $this->getLogger()->error($a_message);
71  }
+ 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.

References $logger.

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

89  : Logger
90  {
91  return $this->logger;
92  }
Logger $logger
+ Here is the caller graph for this function:

◆ info()

ilLogger::info ( string  $a_message)

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

References getLogger().

53  : void
54  {
55  $this->getLogger()->info($a_message);
56  }
+ 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.

References getLogger().

28  : bool
29  {
30  return $this->getLogger()->isHandling($a_level);
31  }
+ 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.

References getLogger().

Referenced by dump().

33  : void
34  {
35  $this->getLogger()->log($a_level, $a_message);
36  }
+ 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.

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

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

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()
+ 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.

References getLogger().

58  : void
59  {
60  $this->getLogger()->notice($a_message);
61  }
+ Here is the call graph for this function:

◆ warning()

ilLogger::warning ( string  $a_message)

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

References getLogger().

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

63  : void
64  {
65  $this->getLogger()->warning($a_message);
66  }
+ 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.

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

Referenced by ilContainerStartObjects\cloneDependencies(), ilItemGroupItems\cloneItems(), ilSurveyParticipantsGUI\deleteSavedMessageObject(), ilStructureObjectGUI\insertChapterClip(), ilSurveyParticipantsGUI\insertSavedMessageObject(), and ilQuestionPageParser\storeTree().

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  }
static getLevels()
+ 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.

References getLogger().

113  : void
114  {
115  $this->getLogger()->debug("Language (" . $a_lang_key . "): topic -" . $a_topic . "- not present");
116  }
+ Here is the call 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.

References getLogger().

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