static void Main(string[] args) { var log = LogManager.GetLogger("console"); log.Trace("trace"); log.Debug("debug"); log.Info("info"); log.Warn("warn"); log.Error("error"); Console.WriteLine("press any key"); Console.ReadKey(); var tlogFactory = new LogFactory(minLevel: LogLevel.Info) { Trace = log.Trace, Debug = log.Debug, Info = m => { Thread.Sleep(new Random().Next(1000)); log.Info(m); //Thread.Sleep(1000); // for async test }, Error = (msg, e) => log.Error(e, msg), Flush = (msg, e) => LogManager.GetLogger("file").Error(e, msg), //FlushLevel = LogLevel.Debug }; //tlogFactory.Trace = null; TestLog(tlogFactory.GetLogger("test logger")); TestLog(tlogFactory.GetAsyncLogger("test async logger")); Console.WriteLine("press any key"); Console.ReadKey(); }
public TransactionalLog(LogFactory factory, string id) { _factory = factory; _identifier = id; }