64 public function __construct($a_log_path, $a_log_file, $a_tag =
"", $a_enabled =
true, $a_log_level = null)
67 include_once
'./Services/Logging/classes/public/class.ilLogLevel.php';
74 $this->current_log_level = $this->
setLogLevel($a_log_level);
76 $this->path = ($a_log_path) ? $a_log_path : ILIAS_ABSOLUTE_PATH;
77 $this->filename = ($a_log_file) ? $a_log_file :
"ilias.log";
78 $this->tag = ($a_tag ==
"") ?
"unknown" : $a_tag;
79 $this->enabled = (bool) $a_enabled;
95 switch (strtolower($a_log_level)) {
103 return $this->default_log_level;
116 if (empty($a_log_level)) {
117 return $this->default_log_level;
120 $level = (int) $a_log_level;
122 if ($a_log_level != (
int) $a_log_level) {
123 return $this->default_log_level;
131 $this->log_format = $a_format;
141 $this->path = $a_str;
152 $this->filename = $a_str;
179 $this->
write(
"Language (" . $a_lang_key .
"): topic -" . $a_topic .
"- not present", $this->MESSAGE);
190 $this->
write(
"WARNING: " . $a_message);
206 $error_level =
"message";
210 $error_level =
"warning";
214 $error_level =
"fatal";
218 $error_level =
"unknown";
222 $this->
write(
"ERROR (" . $error_level .
"): " . $a_msg);
239 public function write($a_msg, $a_log_level = null)
241 if ($this->enabled and $this->current_log_level >= $this->
checkLogLevel($a_log_level)) {
244 if ($this->fp ==
false) {
248 if (fwrite($this->fp, $this->
getLogFormat() . $a_msg .
"\n") == -1) {
254 if ($a_log_level == $this->FATAL) {
265 $this->
write($e->getTraceAsString());
275 public function dump($a_var, $a_log_level = null)
277 $this->
write(print_r($a_var,
true), $a_log_level);
287 $this->fp = @fopen($this->path .
"/" . $this->filename,
"a");
290 if (!$this->fp && $this->enabled) {
291 include_once(
"./Services/Logging/exceptions/class.ilLogException.php");
292 throw new ilLogException(
'Unable to open log file for writing. Please check setup path to log file and possible write access.');
306 public function delete()
308 if (@is_file($this->path .
"/" . $this->filename)) {
309 @unlink($this->path .
"/" . $this->filename);
writeLanguageLog($a_topic, $a_lang_key)
special language checking routine
ILIAS Log exception class.
dump($a_var, $a_log_level=null)
Dump a variable to the log.
write($a_msg, $a_log_level=null)
logging
checkLogLevel($a_log_level)
determine log level
setLogLevel($a_log_level)
set global log level
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
logError($a_code, $a_msg)
this function is automatically called by class.ilErrorHandler in case of an error To log manually ple...
__construct($a_log_path, $a_log_file, $a_tag="", $a_enabled=true, $a_log_level=null)
constructor
writeWarning($a_message)
special warning message