Created
September 13, 2012 17:17
-
-
Save xatest/3715930 to your computer and use it in GitHub Desktop.
add function to Logger err()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static function err($str) | |
{ | |
if ( !strlen($str) ) { | |
return false; | |
} | |
if ( empty(self::$log) ) { | |
self::$log = new Logger(LOG_NAME); | |
} | |
if (self::$log->level < self::ERR) { | |
return false; | |
} | |
$trc = debug_backtrace(); | |
$s = "[" . date('Y-m-d H:i:s') . "]"; | |
$s .= "[ERR][PID=" . trim(self::$log->processID) . "]"; | |
$fileList = preg_split('[\/]', $trc[0]['file']); | |
$s .= "[file=" . $fileList[count($fileList) - 1] . "]"; | |
$s .= "[func=" . $trc[0]['function'] . "]"; | |
$s .= "[line=" . $trc[0]['line'] . "]"; | |
$s .= "[ip=" . trim(self::$log->ip) . "]"; | |
$s .= $str; | |
self::_write($s); | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment