ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 20 of file class.ilLogger.php.

Constructor & Destructor Documentation

◆ __construct()

ilLogger::__construct ( Logger  $logger)

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

References $logger.

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

Member Function Documentation

◆ alert()

ilLogger::alert (   $a_message)

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

References getLogger().

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

◆ critical()

ilLogger::critical (   $a_message)

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

References getLogger().

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

◆ debug()

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

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

References getLogger().

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

◆ dump()

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

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

References log().

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

◆ emergency()

ilLogger::emergency (   $a_message)

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

References getLogger().

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

◆ error()

ilLogger::error (   $a_message)

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

References getLogger().

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

◆ getLogger()

ilLogger::getLogger ( )

Get logger instance.

Returns

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

References $logger.

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

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

◆ info()

ilLogger::info (   $a_message)

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

References getLogger().

55  {
56  return $this->getLogger()->info($a_message);
57  }
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 34 of file class.ilLogger.php.

References getLogger().

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

◆ log()

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

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

References getLogger().

Referenced by dump().

40  {
41  return $this->getLogger()->log($a_level, $a_message);
42  }
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 130 of file class.ilLogger.php.

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

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

◆ notice()

ilLogger::notice (   $a_message)

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

References getLogger().

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

◆ warning()

ilLogger::warning (   $a_message)

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

References getLogger().

65  {
66  return $this->getLogger()->warning($a_message);
67  }
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 104 of file class.ilLogger.php.

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

105  {
106  include_once './Services/Logging/classes/public/class.ilLogLevel.php';
107  if(!in_array($a_level, ilLogLevel::getLevels()))
108  {
109  $a_level = ilLogLevel::INFO;
110  }
111 
112  $this->getLogger()->log($a_level, $a_message);
113  }
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 119 of file class.ilLogger.php.

References getLogger().

120  {
121  $this->getLogger()->debug("Language (".$a_lang_key."): topic -".$a_topic."- not present");
122  }
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 157 of file class.ilLogger.php.

References getLogger().

158  {
159  $this->getLogger()->pushProcessor(new MemoryPeakUsageProcessor());
160  $this->getLogger()->log($a_level, 'Memory usage: ');
161  $this->getLogger()->popProcessor();
162  }
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 22 of file class.ilLogger.php.

Referenced by __construct(), and getLogger().


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