Class: WindLogger
Source Location: /log/WindLogger.php
Class WindLogger
Class Overview
日志记录
日志记录的级别有以下几种: - WindLogger::LEVEL_INFO = 1: 信息记录,只记录需要记录的信息。
- WindLogger::LEVEL_TRACE = 2: 信息记录,同时记录来自trace的信息。
- WindLogger::LEVEL_DEBUG = 3: 信息记录,同时记录来自trace的信息。
- WindLogger::LEVEL_ERROR = 4: 记录错误信息,不包含trace信息。
- WindLogger::LEVEL_PROFILE = 5: 分析信息记录,包含详细的时间及内存使用情况等
日志的存放形式也可以通过write_type设置: - 0: 打印全部日志信息结果
- 1: 按照level分文件存储日志记录
- 2: 按照type分文件存储日志记录
Located in /log/WindLogger.php [line 26]
WindModule
|
--WindLogger
Author(s):
Information Tags:
|
Methods
|
Inherited Properties, Constants, and Methods
Method Summary
void |
debug() |
添加debug级别的日志信息 |
void |
error() |
添加error级别的日志信息 |
boolean |
flush() |
将记录的日志列表信息写入文件 |
void |
info() |
添加info级别的日志信息 |
void |
trace() |
添加trace级别的日志信息 |
Methods
void __construct(
[string
$logDir = ''], [int
$writeType = 0]
)
|
|
构造函数
Parameters:
string |
$logDir: |
日志文件存放的目录 |
int |
$writeType: |
日志文件的保存方式 |
API Tags:
void debug(
string
$msg, [string
$type = 'wind.system'], [boolean
$flush = false]
)
|
|
添加debug级别的日志信息
Parameters:
string |
$msg: |
日志信息 |
string |
$type: |
日志的类型,默认为wind.system |
boolean |
$flush: |
是否将日志输出到文件,为true的时候将写入文件,默认为false |
API Tags:
void error(
string
$msg, [string
$type = 'wind.core'], [boolean
$flush = false]
)
|
|
添加error级别的日志信息
Parameters:
string |
$msg: |
日志信息 |
string |
$type: |
日志的类型,默认为wind.core |
boolean |
$flush: |
是否将日志输出到文件,为true的时候将写入文件,默认为false |
API Tags:
int getMemoryUsage(
[boolean
$peak = true]
)
|
|
返回内存使用量
Parameters:
boolean |
$peak: |
是否是内存峰值,默认为true |
API Tags:
void info(
string
$msg, [string
$type = 'wind.system'], [boolean
$flush = false]
)
|
|
添加info级别的日志信息
Parameters:
string |
$msg: |
日志信息 |
string |
$type: |
日志的类型,默认为wind.system |
boolean |
$flush: |
是否将日志输出到文件,为true的时候将写入文件,默认为false |
API Tags:
void log(
string
$msg, [int
$level = self::LEVEL_INFO], [string
$type = 'wind.system'], [boolean
$flush = false]
)
|
|
添加info级别的日志信息
Parameters:
string |
$msg: |
日志信息 |
int |
$level: |
日志记录的级别,默认为INFO级别即为1 |
string |
$type: |
日志的类型,默认为wind.system |
boolean |
$flush: |
是否将日志输出到文件,为true则将会写入文件,默认为false |
API Tags:
void profileBegin(
string
$msg, [string
$type = 'wind.core'], [boolean
$flush = false]
)
|
|
添加profile级别的开始位置日志信息
通过该接口添加的日志信息将是记录一个开始位置的信息
Parameters:
string |
$msg: |
日志信息 |
string |
$type: |
日志的类型,默认为wind.core |
boolean |
$flush: |
是否将日志输出到文件,为true的时候将写入文件,默认为false |
API Tags:
void profileEnd(
string
$msg, [string
$type = 'wind.core'], [boolean
$flush = false]
)
|
|
添加profile级别的结束位置日志信息
通过该接口添加的日志信息将是记录一个结束位置的信息
Parameters:
string |
$msg: |
日志信息 |
string |
$type: |
日志的类型,默认为wind.core |
boolean |
$flush: |
是否将日志输出到文件,为true的时候将写入文件,默认为false |
API Tags:
void setLogDir(
$logDir, string
$logFile
)
|
|
设置日志保存的路径
Parameters:
string |
$logFile: |
日志保存的路径 |
|
$logDir: |
|
API Tags:
void setMaxFileSize(
$maxFileSize, int
$_maxFileSize
)
|
|
设置日志文件最大的大小
Parameters:
int |
$_maxFileSize: |
文件的最大值 |
|
$maxFileSize: |
|
API Tags:
void trace(
string
$msg, [string
$type = 'wind.system'], [boolean
$flush = false]
)
|
|
添加trace级别的日志信息
Parameters:
string |
$msg: |
日志信息 |
string |
$type: |
日志的类型,默认为wind.system |
boolean |
$flush: |
是否将日志输出到文件,为true的时候将写入文件,默认为false |
API Tags:
Constants
级别3:标志该信息是一个debug
debug信息将会导出trace信息和debug详细信息
级别5:分析信息记录,包含详细的时间及内存使用情况等
|
|