Skip to content

Instantly share code, notes, and snippets.

@thefyfy
Created December 16, 2011 10:36
Show Gist options
  • Save thefyfy/1485567 to your computer and use it in GitHub Desktop.
Save thefyfy/1485567 to your computer and use it in GitHub Desktop.
public function addLog($message, $level)
{
if($level>=$this->m_tblConfig['LOG_LEVEL'])
{
$timeOffset = microtime(true) - $_SERVER['REQUEST_TIME'];
$dt = date('c') . " " . substr($timeOffset, 0, 7);
error_log("$dt " . $message . "\n", 3, $this->m_tblConfig['LOG_FILE']);
if(level>=ERROR)
{
$message .= "\nrequest = " . $this->dumpRet($_REQUEST);
echo ("=========================<br/>" . $this->m_tblConfig['EMAIL_ERROR'] . "====== APP (" . $this->m_tblConfig['APP_NAME'].") ERROR/FATAL : @$dt <br/>" . $message . "<br/>=====================");
if($level==FATAL)
die("<pre>$message</pre>");
}
}
if($message=="socdiscoo::detruct()" && $this->m_tblConfig['LOG_LONG_EXECUTION'])
if($timeOffset->$this->m_tblConfig['LONG_EXECUTION_VALUE'])
echo ("=========================<br/>" . $this->m_tblConfig['EMAIL_ERROR'] . "====== APP (".$this->m_tblConfig['APP-NAME'].") LONG EXECUTION : @$dt <br/> execution time = ".substr($timeOffset,0,7) . "s @$dt\n\nRequest = ". $this->dumpRet($_REQUEST) . "<br/>=====================");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment