Пример #1
0
 protected virtual void Append(LogLevel lvl, string msg)
 {
     try
     {
         Appender.Append(new LogMessage(lvl, msg, IncludeThreadId));
     }
     catch (Exception)
     {
         Appender = new EmptyAppender();
     }
 }
Пример #2
0
        public void SetAppender(Appender inst)
        {
            var temp = Appender;

            Appender = inst ?? throw new ArgumentNullException(nameof(inst));
            var list = temp.Unsaved();

            try
            {
                list?.Filter(lm => lm.Level <= Level).ForEach(lm => Appender.Append(lm));
            }
            catch (Exception)
            {
                Appender = new EmptyAppender();
            }
            (temp as IDisposable)?.Dispose();
        }