public static void RegisterLogger(this ContainerBuilder builder) { builder.Register(ctx => { var applicationId = ctx.ResolveKeyed <string>("Project.Name"); var logLevel = ctx.ResolveKeyed <string>("Log.Level"); var logFilePath = ctx.ResolveKeyed <string>("Log.FilePath"); var azureStorageConnectionString = ctx.ResolveKeyed <string>("Log.AzureStorageConnection"); return(LogConfiguration.Create(applicationId, logLevel, logFilePath, azureStorageConnectionString)); }) .SingleInstance() .As <ILogger>(); }
public static void Main(string[] args) { LogManager.Configuration = LogConfiguration.Create(); LogManager.ReconfigExistingLoggers(); try { logger.Debug("Starting Sparky"); BuildWebHost(args).Run(); } catch (Exception e) { logger.Error(e, "Exiting Sparky because of an exception"); throw; } }