88 $this->
error(
"Can't access $logfile, using syslog");
181 if ($this->logLevel === null) {
182 $this->logLevel =
getParam(
"CORE_LOGLEVEL",
"IWEF");
192 $deb = gettimeofday();
193 $this->deb = $deb[
"sec"] + $deb[
"usec"] / 1000000;
194 $this->
tic = $this->deb;
195 $this->ptext = $text;
203 public function tic($text)
205 $tic = gettimeofday();
206 $now = $tic[
"sec"] + $tic[
"usec"] / 1000000;
207 $duree = round($now - $this->
tic, 3);
208 $this->
info(
"CHRONO-INT [$this->ptext]/[$text] : $duree");
215 public function end($text)
217 $fin = gettimeofday();
218 $this->fin = $fin[
"sec"] + $fin[
"usec"] / 1000000;
219 $duree = round($this->fin - $this->deb, 3);
220 $this->
info(
"CHRONO [$this->ptext]/[$text] : $duree");
226 global $call_ind, $call_stack, $call_pre, $call_reqid;
227 if (!isset($call_ind)) $call_ind = 0;
228 if (!isset($call_pre)) $call_pre =
"-";
229 if (!isset($call_reqid)) $call_reqid = rand(1, 100);
230 $this->
callstack(
"($call_reqid) $call_pre : entering $string");
231 $call_stack[$call_ind] = $string;
233 $call_pre = $call_pre .
"-";
240 global $call_ind, $call_stack, $call_pre, $call_reqid;
241 $call_pre = substr($call_pre, 0, strlen($call_pre) - 1);
243 $this->
callstack(
"($call_reqid) $call_pre : exiting {$call_stack[$call_ind]}");
253 public function wlog($sta, $str,
$args = NULL, $facility = LOG_LOCAL6)
258 if (is_array($str)) $str = implode(
", ", $str);
259 if ($sta ==
"S" || (is_int(strpos($this->
getLogLevel() , $sta)))) {
260 $addr = isset($_SERVER[
"REMOTE_ADDR"]) ? $_SERVER[
"REMOTE_ADDR"] :
'';
261 $appf =
"[{$sta}] Dynacase";
262 $appf.= ($this->application !=
"" ?
":" . $this->application :
"");
263 $appf.= ($this->
function !=
"" ?
":" . $this->
function :
"");
264 $str =
' ' . $this->loghead .
': ' . $str;
265 if (!$this->usesyslog) {
266 $xx = date(
"d/m/Y H:i:s", time()) .
" {$appf} [{$addr}] ";
267 $xx = $xx . $str .
"\n";
268 $fd = fopen($this->logfile,
"a");
278 $class = (isset($td[4][
"class"])) ? $td[4][
"class"] :
'';
279 $td = @debug_backtrace(
false);
283 $str.= sprintf(
"%s called in %s%s%s(), file %s:%s", isset($td[3][
"function"]) ? $td[3][
"function"] :
'',
$class,
$class ?
'::' :
'', isset($td[4][
"function"]) ? $td[4][
"function"] :
'', isset($td[3][
"file"]) ? $td[3][
"file"] :
'', isset($td[3][
"line"]) ? $td[3][
"line"] :
'');
310 if (empty($_SERVER[
'HTTP_HOST'])) {
311 error_log(sprintf(
"%s LOG::$appf %s", date(
"d/m/Y H:i:s", time()) , $str));
313 openlog(
"{$appf}", 0, $facility);
314 syslog($pri,
"[{$addr}] " . $str);
if(substr($wsh, 0, 1)!= '/') $args
__construct($logfile="", $application="", $function="")
getParam($name, $def="")
must be in core or global type
wlog($sta, $str, $args=NULL, $facility=LOG_LOCAL6)