开发者

How to use KLogger?

Common handler i used

<?php
function error_msg($err_type,$err_msg开发者_Go百科,$err_file,$err_line)
{
$fh=fopen("error/errorlog.txt","a");
$date1=date("Y-m-d H:i:s");
$er="
===============================================================================================================
"."
Error: Type: ".$err_type."Message: ".$err_msg."ErrorFile: ".$err_file."Errorline: ".$err_line."Time: ".$date1.
"
===============================================================================================================
";
fwrite($fh,$er);
fclose($fh);
}
set_error_handler("error_msg");
?>

These codes Log error perfectly. Since i am using framework i cant use this codes. so i am using KLogger. KLogger perfectly logs my error but it also display error in front screen to user.

How to log error using KLogger If any one use this KLogger Help me how to use with simple examples.


Just do something like:

require_once 'KLogger.php';

$log = KLogger::instance('/var/log/');
$log->logInfo('Returned a million search results');
$log->logFatal('Oh dear.');

# Output will log to the path you specified, at log_[current-date].txt

It's crazy simple. Read the docs at GitHub

PS, I wrote KLogger.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜