public static function critical($message, array $content = array(), $module = '') { self::setLogPath(); if ($module != '') { \SeasLog::critical($message, $content, $module); } else { \SeasLog::critical($message, $content); } }
/** * 返回错误 * * @param string $msg * @param string $sql */ public function halt($msg = '', $sql = '') { $error_info = $this->_sth->errorInfo(); $s = '<html> <head> <title>ERROR</title> <style type="text/css"> body {background-color: #fff;margin:40px;font-family: Lucida Grande, Verdana, Sans-serif;font-size:12px;color:#000;} #content {border: #999 1px solid;background-color: #fff;padding: 20px 20px 12px 20px;} h1 {font-weight:normal;font-size:14px;color:#990000;margin:0 0 4px 0;} </style> </head> <body> <div id="content"> <h1>' . $error_info[2] . '</h1> ' . $error_info[1] . '<br> ' . $this->_sql . ' </div> </body> </html>'; SeasLog::critical(json_encode($error_info)); exit($s); }
<?php /** * @Author: leandre * @Date: 2015-10-15 11:08:43 * @Last Modified by: leandre * @Last Modified time: 2015-10-15 11:15:24 */ SeasLog::setBasePath('./logs/'); SeasLog::setLogger('test'); SeasLog::info('this is a info log'); SeasLog::notice('this is a notice log'); SeasLog::flushBuffer(); sleep(60); SeasLog::error('a error log'); SeasLog::critical('some thing was critical');