More logging

This commit is contained in:
Jamie.Rees 2017-09-21 08:33:13 +01:00
commit e63b697d4d
3 changed files with 100 additions and 36 deletions

View file

@ -42,20 +42,21 @@ namespace Ombi.Schedule.Jobs.Ombi
Logger.LogInformation(LoggingEvents.Updater, "Product Version {0}", productVersion);
c.WriteLine("Product Version {0}", productVersion);
var productArray = productVersion.Split('-');
var version = productArray[0];
var branch = productArray[1];
Logger.LogInformation(LoggingEvents.Updater, "Version {0}", version);
Logger.LogInformation(LoggingEvents.Updater, "Branch {0}", branch);
try
{
var productArray = productVersion.Split('-');
var version = productArray[0];
c.WriteLine("Version {0}", version);
var branch = productArray[1];
c.WriteLine("Branch Version {0}", branch);
Logger.LogInformation(LoggingEvents.Updater, "Version {0}", version);
Logger.LogInformation(LoggingEvents.Updater, "Branch {0}", branch);
c.WriteLine("Looking for updates now");
var updates = await OmbiService.GetUpdates(branch);
var serverVersion = updates.UpdateVersionString;
Logger.LogInformation(LoggingEvents.Updater, "Service Version {0}", updates.UpdateVersionString);
c.WriteLine("Service Version {0}", updates.UpdateVersionString);
@ -76,7 +77,6 @@ namespace Ombi.Schedule.Jobs.Ombi
{
Logger.LogInformation(LoggingEvents.Updater, "We are OSX");
download = updates.Downloads.FirstOrDefault(x => x.Name.Contains("osx", CompareOptions.IgnoreCase));
}
else
{
@ -164,7 +164,6 @@ namespace Ombi.Schedule.Jobs.Ombi
{
proc.Start();
}
}
}
catch (Exception e)

View file

@ -57,22 +57,22 @@ namespace Ombi
.AddEnvironmentVariables();
Configuration = builder.Build();
if (env.IsDevelopment())
{
//if (env.IsDevelopment())
//{
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.WriteTo.RollingFile(Path.Combine(env.ContentRootPath, "Logs", "log-{Date}.txt"))
.WriteTo.SQLite("Ombi.db", "Logs", LogEventLevel.Debug)
.CreateLogger();
}
if (env.IsProduction())
{
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.WriteTo.RollingFile(Path.Combine(env.ContentRootPath, "Logs", "log-{Date}.txt"))
.WriteTo.SQLite("Ombi.db", "Logs", LogEventLevel.Debug)
.CreateLogger();
}
//}
//if (env.IsProduction())
//{
// Log.Logger = new LoggerConfiguration()
// .MinimumLevel.Debug()
// .WriteTo.RollingFile(Path.Combine(env.ContentRootPath, "Logs", "log-{Date}.txt"))
// .WriteTo.SQLite("Ombi.db", "Logs", LogEventLevel.Debug)
// .CreateLogger();
//}
}
public IConfigurationRoot Configuration { get; }
@ -102,7 +102,6 @@ namespace Ombi
var tokenValidationParameters = new TokenValidationParameters
{
ValidateIssuerSigningKey = true,
IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(tokenOptions.GetValue("SecretKey", string.Empty))),
@ -188,9 +187,6 @@ namespace Ombi
x.UseConsole();
});
// Build the intermediate service provider
var serviceProvider = services.BuildServiceProvider();
@ -238,16 +234,13 @@ namespace Ombi
jobSetup.Setup();
ctx.Seed();
var provider = new FileExtensionContentTypeProvider();
provider.Mappings[".map"] = "application/octet-stream";
var provider = new FileExtensionContentTypeProvider {Mappings = {[".map"] = "application/octet-stream"}};
app.UseStaticFiles(new StaticFileOptions()
{
ContentTypeProvider = provider
});
app.UseAuthentication();
//ApiKeyMiddlewear(app, serviceProvider);