ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 ($a_level)
 Check whether current logger is handling a log level. More...
 
 log ($a_message, $a_level=ilLogLevel::INFO)
 
 dump ($a_variable, $a_level=ilLogLevel::INFO)
 
 debug ($a_message, $a_context=array())
 
 info ($a_message)
 
 notice ($a_message)
 
 warning ($a_message)
 
 error ($a_message)
 
 critical ($a_message)
 
 alert ($a_message)
 
 emergency ($a_message)
 
 getLogger ()
 Get logger instance. More...
 
 write ($a_message, $a_level=ilLogLevel::INFO)
 write log message More...
 
 writeLanguageLog ($a_topic, $a_lang_key)
 Write language log. More...
 
 logStack ($a_level=null, $a_message='')
 log stack trace More...
 
 writeMemoryPeakUsage ($a_level)
 Write memory peak usage Automatically called at end of script. More...
 

Private Attributes

 $logger = null
 

Detailed Description

Component logger with individual log levels by component id.

Author
Stefan Meyer
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilLogger::__construct ( Logger  $logger)

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

References $logger.

24  {
25  $this->logger = $logger;
26  }

Member Function Documentation

◆ alert()

ilLogger::alert (   $a_message)

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

References getLogger().

79  {
80  return $this->getLogger()->alert($a_message);
81  }
getLogger()
Get logger instance.
+ Here is the call graph for this function:

◆ critical()

ilLogger::critical (   $a_message)

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

References getLogger().

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

◆ debug()

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

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

References getLogger().

Referenced by ilForumAppEventListener\delegateNotification(), and ilForumAppEventListener\sendNotification().

49  {
50  return $this->getLogger()->debug($a_message, $a_context);
51  }
getLogger()
Get logger instance.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dump()

ilLogger::dump (   $a_variable,
  $a_level = ilLogLevel::INFO 
)

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

References log().

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

◆ emergency()

ilLogger::emergency (   $a_message)

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

References getLogger().

85  {
86  return $this->getLogger()->emergency($a_message);
87  }
getLogger()
Get logger instance.
+ Here is the call graph for this function:

◆ error()

ilLogger::error (   $a_message)

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

References getLogger().

Referenced by ilRandom\int().

69  {
70  return $this->getLogger()->error($a_message);
71  }
getLogger()
Get logger instance.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLogger()

ilLogger::getLogger ( )

Get logger instance.

Returns

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

References $logger.

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

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

◆ info()

ilLogger::info (   $a_message)

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

References getLogger().

54  {
55  return $this->getLogger()->info($a_message);
56  }
getLogger()
Get logger instance.
+ Here is the call graph for this function:

◆ isHandling()

ilLogger::isHandling (   $a_level)

Check whether current logger is handling a log level.

Parameters
int$a_level
Returns
bool

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

References getLogger().

34  {
35  return $this->getLogger()->isHandling($a_level);
36  }
getLogger()
Get logger instance.
+ Here is the call graph for this function:

◆ log()

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

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

References getLogger().

Referenced by dump().

39  {
40  return $this->getLogger()->log($a_level, $a_message);
41  }
getLogger()
Get logger instance.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ logStack()

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

log stack trace

Parameters
type$a_level
type$a_message
Exceptions

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

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

Referenced by ilRandom\int().

129  {
130  if (is_null($a_level)) {
131  $a_level = ilLogLevel::INFO;
132  }
133 
134  include_once './Services/Logging/classes/public/class.ilLogLevel.php';
135  if (!in_array($a_level, ilLogLevel::getLevels())) {
136  $a_level = ilLogLevel::INFO;
137  }
138 
139 
140  try {
141  throw new \Exception($a_message);
142  } catch (Exception $ex) {
143  $this->getLogger()->log($a_level, $a_message . "\n" . $ex->getTraceAsString());
144  }
145  }
static getLevels()
getLogger()
Get logger instance.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ notice()

ilLogger::notice (   $a_message)

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

References getLogger().

59  {
60  return $this->getLogger()->notice($a_message);
61  }
getLogger()
Get logger instance.
+ Here is the call graph for this function:

◆ warning()

ilLogger::warning (   $a_message)

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

References getLogger().

64  {
65  return $this->getLogger()->warning($a_message);
66  }
getLogger()
Get logger instance.
+ Here is the call graph for this function:

◆ write()

ilLogger::write (   $a_message,
  $a_level = ilLogLevel::INFO 
)

write log message

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

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

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

104  {
105  include_once './Services/Logging/classes/public/class.ilLogLevel.php';
106  if (!in_array($a_level, ilLogLevel::getLevels())) {
107  $a_level = ilLogLevel::INFO;
108  }
109 
110  $this->getLogger()->log($a_level, $a_message);
111  }
static getLevels()
getLogger()
Get logger instance.
+ Here is the call graph for this function:

◆ writeLanguageLog()

ilLogger::writeLanguageLog (   $a_topic,
  $a_lang_key 
)

Write language log.

Deprecated:
since version 5.1

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

References getLogger().

118  {
119  $this->getLogger()->debug("Language (" . $a_lang_key . "): topic -" . $a_topic . "- not present");
120  }
getLogger()
Get logger instance.
+ Here is the call graph for this function:

◆ writeMemoryPeakUsage()

ilLogger::writeMemoryPeakUsage (   $a_level)

Write memory peak usage Automatically called at end of script.

Parameters
int$a_level

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

References getLogger().

153  {
154  $this->getLogger()->pushProcessor(new MemoryPeakUsageProcessor());
155  $this->getLogger()->log($a_level, 'Memory usage: ');
156  $this->getLogger()->popProcessor();
157  }
Injects memory_get_peak_usage in all records.
getLogger()
Get logger instance.
+ Here is the call graph for this function:

Field Documentation

◆ $logger

ilLogger::$logger = null
private

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

Referenced by __construct(), and getLogger().


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