private static ILogProvider ResolveLogProvider() { try { if (NLogLogProvider.IsLoggerAvailable()) { return(new NLogLogProvider()); } if (Log4NetLogProvider.IsLoggerAvailable()) { return(new Log4NetLogProvider()); } if (EntLibLogProvider.IsLoggerAvailable()) { return(new EntLibLogProvider()); } if (SerilogLogProvider.IsLoggerAvailable()) { return(new SerilogLogProvider()); } if (LoupeLogProvider.IsLoggerAvailable()) { return(new LoupeLogProvider()); } } catch (Exception ex) { Console.WriteLine( "Exception occured resolving a log provider. Logging for this assembly {0} is disabled. {1}", typeof(LogProvider).Assembly.FullName, ex); } return(null); }
private static ILogProvider ResolveLogProvider() { if (NLogLogProvider.IsLoggerAvailable()) { return(new NLogLogProvider()); } if (Log4NetLogProvider.IsLoggerAvailable()) { return(new Log4NetLogProvider()); } return(EntLibLogProvider.IsLoggerAvailable() ? new EntLibLogProvider() : null); }
public static IEventFlowOptions UseLibLog( this IEventFlowOptions eventFlowOptions, LibLogProviders libLogProviders) { ILogProvider logProvider; switch (libLogProviders) { case LibLogProviders.EntLib: logProvider = new EntLibLogProvider(); break; case LibLogProviders.Log4Net: logProvider = new Log4NetLogProvider(); break; case LibLogProviders.Loupe: logProvider = new LoupeLogProvider(); break; case LibLogProviders.NLog: logProvider = new NLogLogProvider(); break; case LibLogProviders.Serilog: logProvider = new SerilogLogProvider(); break; default: throw new ArgumentOutOfRangeException(nameof(libLogProviders), libLogProviders, null); } var log = new LibLog(logProvider); return(eventFlowOptions .RegisterServices(sr => sr.Register <ILog>(_ => log, Lifetime.Singleton))); }
public void PerTestSetUp() { LogMock = new Mock<ILog>(); Log = LogMock.Object; LogProvider = new Log4NetLogProvider(Log); }