23 protected static $levels = array(
35 protected $display =
false;
52 $this->hooks = $hooks;
63 if (is_string($level)) {
64 $levelStringsToInts = array_flip(self::$levels);
65 $level = $levelStringsToInts[$level];
67 $this->level = $level;
90 $this->display = $display;
101 if ($this->level == self::OFF || $level < $this->level) {
105 if (!array_key_exists($level, self::$levels)) {
109 $levelString = self::$levels[$level];
112 $display = $this->display && $level > self::NOTICE;
114 $this->process(
"$levelString: $message", $display, $level);
136 return $this->log(
$message, self::WARNING);
146 return $this->log(
$message, self::NOTICE);
156 return $this->log(
$message, self::INFO);
185 'display' => $display,
186 'to_screen' => $display,
189 if (!$this->hooks->trigger(
'debug',
'log',
$params,
true)) {
196 if (!isset($this->CONFIG->pagesetupdone)) {
205 if ($display ==
true) {
206 echo '<pre class="elgg-logger-data">';
207 echo htmlspecialchars(print_r(
$data,
true), ENT_QUOTES,
'UTF-8');
210 error_log(print_r(
$data,
true));
process($data, $display, $level)
Process logging data.
getLevel()
Get the current logging level.
setDisplay($display)
Set whether the logging should be displayed to the user.
setLevel($level)
Set the logging level.
elgg_in_context($context)
Check if this context exists anywhere in the stack.
elgg echo
Translates a string.
elgg global
Pointer to the global context.
error($message)
Log message at the ERROR level.
log($message, $level=self::NOTICE)
Add a message to the log.
dump($data, $display=true)
Dump data to log or screen.
__construct(\Elgg\PluginHooksService $hooks)
Constructor.
info($message)
Log message at the INFO level.
warn($message)
Log message at the WARNING level.
notice($message)
Log message at the NOTICE level.