public static void UseSeriLog(this IServiceCollection services, LoggerConfiguration configuration) { // todo: serilog integration into routine, extract services.AddSingleton <ILoggerFactory>(collection => { var loggerSettings = collection.GetService <ApplicationSettings>().Logging; configuration.Configure(loggerSettings); return(new SerilogLoggerFactory(Log.Logger, true)); }); }
public void Configure(IDependencyContainer container) { container.ThrowIfNull(); var configuration = new LoggerConfiguration(); configuration.Configure(); (container as DependencyContainer).UnityContainer.AddExtension(new LoggerConstructorInjectionExtension()); container.Register.Instance <ILoggerFactory>(new LoggerFactory()); }
/// <summary> /// Create trace logger /// </summary> /// <param name="configuration"></param> /// <param name="addConsole"></param> /// <returns></returns> public static LoggerConfiguration Debug(this LoggerConfiguration configuration, bool addConsole = true) { return(configuration.Configure((c, m) => c .WriteTo.Debug(outputTemplate: m), addConsole)); }