ILIAS  trunk Revision v11.0_alpha-1769-g99a433fe2dc
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator 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 (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 = [] 
)

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

References $context, and getLogger().

84  : void
85  {
86  $this->getLogger()->alert($message, $context);
87  }
$context
Definition: webdav.php:31
$message
Definition: xapiexit.php:31
+ Here is the call graph for this function:

◆ critical()

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

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

References $context, and getLogger().

79  : void
80  {
81  $this->getLogger()->critical($message, $context);
82  }
$context
Definition: webdav.php:31
$message
Definition: xapiexit.php:31
+ Here is the call graph for this function:

◆ debug()

◆ dump()

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

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

References log().

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=[])
+ Here is the call graph for this function:

◆ emergency()

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

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

References $context, and getLogger().

89  : void
90  {
91  $this->getLogger()->emergency($message, $context);
92  }
$context
Definition: webdav.php:31
$message
Definition: xapiexit.php:31
+ Here is the call graph for this function:

◆ error()

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

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

References $context, and getLogger().

74  : void
75  {
76  $this->getLogger()->error($message, $context);
77  }
$context
Definition: webdav.php:31
$message
Definition: xapiexit.php:31
+ Here is the call graph for this function:

◆ getLogger()

ilLogger::getLogger ( )

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

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

94  : Logger
95  {
96  return $this->logger;
97  }
+ Here is the caller graph for this function:

◆ info()

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

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

References $context, and getLogger().

59  : void
60  {
61  $this->getLogger()->info($message, $context);
62  }
$context
Definition: webdav.php:31
$message
Definition: xapiexit.php:31
+ Here is the call graph for this function:

◆ isHandling()

ilLogger::isHandling ( int  $level)

Check whether current logger is handling a log level.

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

References getLogger().

37  : bool
38  {
39  return $this->getLogger()->isHandling($level);
40  }
+ Here is the call graph for this function:

◆ log()

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

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

References $context, and getLogger().

Referenced by dump().

42  : void
43  {
44  $this->getLogger()->log($level, $message, $context);
45  }
$context
Definition: webdav.php:31
$message
Definition: xapiexit.php:31
+ 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 = [] 
)

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

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

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

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  }
$context
Definition: webdav.php:31
static getLevels()
$message
Definition: xapiexit.php:31
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ notice()

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

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

References $context, and getLogger().

64  : void
65  {
66  $this->getLogger()->notice($message, $context);
67  }
$context
Definition: webdav.php:31
$message
Definition: xapiexit.php:31
+ Here is the call graph for this function:

◆ warning()

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

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

References $context, and getLogger().

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

69  : void
70  {
71  $this->getLogger()->warning($message, $context);
72  }
$context
Definition: webdav.php:31
$message
Definition: xapiexit.php:31
+ 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(), ...

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

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

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

104  : void
105  {
106  if (!in_array($level, ilLogLevel::getLevels())) {
107  $level = ilLogLevel::INFO;
108  }
109  $this->getLogger()->log((int) $level, $message, $context);
110  }
$context
Definition: webdav.php:31
static getLevels()
$message
Definition: xapiexit.php:31
+ 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

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

References getLogger().

116  : void
117  {
118  $this->getLogger()->debug("Language (" . $lang_key . "): topic -" . $topic . "- not present");
119  }
+ Here is the call graph for this function:

◆ writeMemoryPeakUsage()

ilLogger::writeMemoryPeakUsage ( int  $level)

Write memory peak usage Automatically called at end of script.

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

References getLogger().

143  : void
144  {
145  $this->getLogger()->pushProcessor(new MemoryPeakUsageProcessor());
146  $this->getLogger()->log($level, 'Memory usage: ');
147  $this->getLogger()->popProcessor();
148  }
+ Here is the call graph for this function:

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