Esempio n. 1
0
        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>();
        }
Esempio n. 2
0
        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;
            }
        }