示例#1
0
        /// <summary>
        /// 重写 WriteLogMessage 方法将日志写入文本文件
        /// </summary>
        /// <param name="entry">日志条目对象</param>
        /// <param name="lines">要写入的文本行</param>
        protected override void WriteLogMessage( LogEntry entry, string[] lines )
        {
            var path = GetFilepath( entry );

              var build = new StringBuilder();
              foreach ( var l in lines )
              {
            build.Append( l );
            build.Append( Environment.NewLine );
              }

              TextLogFileManager.WriteText( path, build.ToString(), Encoding, entry.LogType().Serverity >= LogType.Error.Serverity );
        }
示例#2
0
        /// <summary>
        /// 重写 WriteLogMessage 方法将日志写入文本文件
        /// </summary>
        /// <param name="entry">日志条目对象</param>
        /// <param name="lines">要写入的文本行</param>
        protected override void WriteLogMessage(LogEntry entry, string[] lines)
        {
            var path = GetFilepath(entry);

            var build = new StringBuilder();

            foreach (var l in lines)
            {
                build.Append(l);
                build.Append(Environment.NewLine);
            }

            TextLogFileManager.WriteText(path, build.ToString(), Encoding, entry.LogType().Serverity >= LogType.Error.Serverity);
        }
示例#3
0
 /// <summary>
 /// 获取日志消息的填充,将会自动添加在日志消息的每一行的开头
 /// </summary>
 /// <param name="entry">当前要记录的日志</param>
 /// <returns>当前日志消息的填充</returns>
 protected virtual string GetPadding(LogEntry entry)
 {
     return(GetTypePrefix(entry.LogType()) + " " + GetDateTime(entry).ToString(DateTimeFormatString) + " ");
 }
示例#4
0
            public override bool Writable( LogEntry entry )
            {
                var serverity = entry.LogType().Serverity;

                return serverity >= MinServerity && serverity < MaxServerity;
            }
示例#5
0
 public override bool Writable( LogEntry entry )
 {
     return LogType.Equals( entry.LogType() );
 }
示例#6
0
 public override bool Writable(LogEntry entry)
 {
     return(LogType.Equals(entry.LogType()));
 }
示例#7
0
            public override bool Writable(LogEntry entry)
            {
                var serverity = entry.LogType().Serverity;

                return(serverity >= MinServerity && serverity < MaxServerity);
            }
示例#8
0
 /// <summary>
 /// 获取日志消息的填充,将会自动添加在日志消息的每一行的开头
 /// </summary>
 /// <param name="entry">当前要记录的日志</param>
 /// <returns>当前日志消息的填充</returns>
 protected virtual string GetPadding( LogEntry entry )
 {
     return GetTypePrefix( entry.LogType() ) + " " + GetDateTime( entry ).ToString( DateTimeFormatString ) + " ";
 }