protected virtual void Append(LogLevel lvl, string msg) { try { Appender.Append(new LogMessage(lvl, msg, IncludeThreadId)); } catch (Exception) { Appender = new EmptyAppender(); } }
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(); }