添加日志
parent
73a57d1a14
commit
844ffdcabd
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
namespace Base\Tool;
|
||||
|
||||
use Think\Log as BaseLog;
|
||||
|
||||
class Log
|
||||
{
|
||||
public static function info($content, $fileName = '')
|
||||
{
|
||||
self::write($content, BaseLog::INFO, $fileName);
|
||||
}
|
||||
|
||||
public static function error($content, $fileName = '')
|
||||
{
|
||||
self::write($content, BaseLog::ERR, $fileName);
|
||||
}
|
||||
|
||||
public static function debug($content, $fileName = '')
|
||||
{
|
||||
self::write($content, BaseLog::DEBUG, $fileName);
|
||||
}
|
||||
|
||||
public static function warning($content, $fileName = '')
|
||||
{
|
||||
self::write($content, BaseLog::WARN, $fileName);
|
||||
}
|
||||
|
||||
public static function notice($content, $fileName = '')
|
||||
{
|
||||
self::write($content, BaseLog::NOTICE, $fileName);
|
||||
}
|
||||
|
||||
public static function alert($content, $fileName = '')
|
||||
{
|
||||
self::write($content, BaseLog::ALERT, $fileName);
|
||||
}
|
||||
|
||||
public static function critical($content, $fileName = '')
|
||||
{
|
||||
self::write($content, BaseLog::CRIT, $fileName);
|
||||
}
|
||||
|
||||
public static function emergency($content, $fileName = '')
|
||||
{
|
||||
self::write($content, BaseLog::EMERG, $fileName);
|
||||
}
|
||||
|
||||
private static function write($content, $level, $fileName)
|
||||
{
|
||||
$fileName = $fileName == '' ? 'app' : $fileName;
|
||||
$destination = RUNTIME_PATH . 'Logs/Common/' . $fileName . '_' . date('y_m_d') . '.log';
|
||||
BaseLog::write($content, $level, '', $destination);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue