63 function ilLog($a_log_path, $a_log_file, $a_tag =
"", $a_enabled =
true, $a_log_level = NULL)
71 $this->current_log_level = $this->
setLogLevel($a_log_level);
74 $this->filename = ($a_log_file) ? $a_log_file :
"ilias.log";
75 $this->tag = ($a_tag ==
"") ?
"unknown" : $a_tag;
76 $this->enabled = (bool) $a_enabled;
77 $this->
setLogFormat(@date(
"[y-m-d H:i:s] ").
"[".$this->tag.
"] ");
92 switch (strtolower($a_log_level))
101 return $this->default_log_level;
114 if (empty($a_log_level))
115 return $this->default_log_level;
117 $level = (int) $a_log_level;
119 if ($a_log_level != (
int) $a_log_level)
120 return $this->default_log_level;
127 $this->log_format = $a_format;
137 $this->path = $a_str;
142 $this->filename = $a_str;
163 $this->
write(
"Language (".$a_lang_key.
"): topic -".$a_topic.
"- not present",$this->MESSAGE);
174 $this->
write(
"WARNING: ".$a_message);
191 $error_level =
"message";
195 $error_level =
"warning";
199 $error_level =
"fatal";
203 $error_level =
"unknown";
207 $this->
write(
"ERROR (".$error_level.
"): ".$a_msg);
224 function write($a_msg, $a_log_level = NULL)
226 if ($this->enabled and $this->current_log_level >= $this->
checkLogLevel($a_log_level))
230 if ($this->fp ==
false)
235 if (fwrite($this->fp,$this->
getLogFormat().$a_msg.
"\n") == -1)
242 if ($a_log_level == $this->FATAL)
257 $this->
write($e->getTraceAsString());
267 function dump($a_var, $a_log_level = NULL)
269 $this->
write(print_r($a_var,
true), $a_log_level);
276 $this->fp = @fopen ($this->path.
"/".$this->filename,
"a");
292 if (@is_file($this->path.
"/".$this->filename))
294 @unlink($this->path.
"/".$this->filename);