You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.4 KiB
PHTML

3 years ago
<?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);
}
}