Constants

DATE_FORMATS

DATE_FORMATS = array('d', 'D', 'j', 'l', 'N', 'S', 'w', 'z', 'W', 'F', 'm', 'M', 'n', 't', 'L', 'o', 'Y', 'y', 'a', 'A', 'B', 'g', 'G', 'h', 'H', 'i', 's', 'u', 'e', 'I', 'O', 'P', 'T', 'Z', 'c', 'r', 'U')

date()函数支持的格式

Properties

$records

$records : array<mixed,\Imi\Log\Record>

日志记录

Type

array<mixed,\Imi\Log\Record>

$levels

$levels : array<mixed,string>

允许记录的日志等级们

Type

array<mixed,string>

$logCacheNumber

$logCacheNumber : integer

日志缓存数量 当日志达到指定条数时,执行批量写入操作,减少对性能的影响

Type

integer

$format

$format : string

日志格式

Type

string

$traceFormat

$traceFormat : string

调用跟踪格式

Type

string

$traceLimit

$traceLimit : integer

限制 trace 条目数量,默认为 -1 不限制

Type

integer

$dateFormatsCacheStr

$dateFormatsCacheStr : string

date()函数支持的格式缓存文本

Type

string

Methods

__construct()

__construct(  $option = array()) 

Parameters

$option

log()

log(\Imi\Log\Record  $record) : void

写日志

Parameters

\Imi\Log\Record $record

logBatch()

logBatch(array<mixed,\Imi\Log\Record>  $logs) : void

批量写日志

Parameters

array<mixed,\Imi\Log\Record> $logs

trySave()

trySave() : void

尝试保存日志,当满足保存条件时才保存

save()

save() : void

保存日志,直接写入

getDateTime()

getDateTime(string  $time = null) : string

获取日期时间

Parameters

string $time

不传则使用当前时间

Returns

string

getLogString()

getLogString(\Imi\Log\Record  $record) : string

获取日志字符串

Parameters

\Imi\Log\Record $record

Returns

string

parseTrace()

parseTrace(\Imi\Log\Record  $record) : string

处理代码调用跟踪

Parameters

\Imi\Log\Record $record

Returns

string

getTraceCall()

getTraceCall(  $trace) : string

获取调用跟踪的调用

Parameters

$trace

Returns

string

getTraceArgs()

getTraceArgs(  $trace) : string

获取调用跟踪的方法参数

Parameters

$trace

Returns

string

__save()

__save() : void

真正的保存操作实现

replaceDateTime()

replaceDateTime(string  $string, integer  $timestamp) : void

替换日期时间参数

Parameters

string $string
integer $timestamp