C# Class Ivony.Logs.TextLogger

文本日志记录器基类,将日志信息以文本形式记录的所有记录器的基类
Inheritance: Logger
显示文件 Open project: Ivony/LogUtility

Public Methods

Method Description
LogEntry ( LogEntry entry ) : void

写入一条日志信息

Protected Methods

Method Description
GetDateTime ( LogEntry entry ) : System.DateTime

获取转换时区后的日志记录时间

GetPadding ( LogEntry entry ) : string

获取日志消息的填充,将会自动添加在日志消息的每一行的开头

GetTypePrefix ( LogType type ) : string

获取日志消息的类型前缀,将会自动添加在每一行消息以标识这个消息的类型

ReleaseWriter ( TextWriter writer ) : void

释放文本编写器

SplitMultiLine ( string message ) : string[]

将多行消息按照换行符拆分成多个字符串

TextLogger ( LogFilter filter = null, TimeZoneInfo timezone = null ) : System

创建 TextLogger 对象

Write ( LogEntry entry, string padding, string message ) : void

使用指定的前缀写入多行日志

WriteLogMessage ( LogEntry entry, string contents ) : void

派生类实现此方法写入日志

Method Details

GetDateTime() protected method

获取转换时区后的日志记录时间
protected GetDateTime ( LogEntry entry ) : System.DateTime
entry LogEntry 日志条目
return System.DateTime

GetPadding() protected method

获取日志消息的填充,将会自动添加在日志消息的每一行的开头
protected GetPadding ( LogEntry entry ) : string
entry LogEntry 当前要记录的日志
return string

GetTypePrefix() protected method

获取日志消息的类型前缀,将会自动添加在每一行消息以标识这个消息的类型
protected GetTypePrefix ( LogType type ) : string
type LogType 当前要记录的日志
return string

LogEntry() public method

写入一条日志信息
public LogEntry ( LogEntry entry ) : void
entry LogEntry
return void

ReleaseWriter() protected method

释放文本编写器
protected ReleaseWriter ( TextWriter writer ) : void
writer System.IO.TextWriter
return void

SplitMultiLine() protected method

将多行消息按照换行符拆分成多个字符串
protected SplitMultiLine ( string message ) : string[]
message string 多行消息
return string[]

TextLogger() protected method

创建 TextLogger 对象
protected TextLogger ( LogFilter filter = null, TimeZoneInfo timezone = null ) : System
filter LogFilter 日志筛选器
timezone System.TimeZoneInfo 时区信息(默认为UTC-0)
return System

Write() protected method

使用指定的前缀写入多行日志
protected Write ( LogEntry entry, string padding, string message ) : void
entry LogEntry 要写入的日志条目
padding string 填充字符串,将会添加在每一行日志的前面
message string 要写入的日志消息
return void

WriteLogMessage() protected abstract method

派生类实现此方法写入日志
protected abstract WriteLogMessage ( LogEntry entry, string contents ) : void
entry LogEntry 要写入的日志条目
contents string 要写入的日志内容
return void