Ejemplo n.º 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 );
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 获取日志消息的填充,将会自动添加在日志消息的每一行的开头
 /// </summary>
 /// <param name="entry">当前要记录的日志</param>
 /// <returns>当前日志消息的填充</returns>
 protected virtual string GetPadding(LogEntry entry)
 {
     return(GetTypePrefix(entry.LogType()) + " " + GetDateTime(entry).ToString(DateTimeFormatString) + " ");
 }
Ejemplo n.º 4
0
            public override bool Writable( LogEntry entry )
            {
                var serverity = entry.LogType().Serverity;

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

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