mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
core: reduce log traces in info level. add start/stop log traces (#7305)
This commit is contained in:
@@ -104,8 +104,7 @@ namespace Jackett.Common.Services
|
|||||||
var files = existingDirectories.SelectMany(d => d.GetFiles("*.yml"));
|
var files = existingDirectories.SelectMany(d => d.GetFiles("*.yml"));
|
||||||
var definitions = files.Select(file =>
|
var definitions = files.Select(file =>
|
||||||
{
|
{
|
||||||
logger.Info("Loading Cardigann definition " + file.FullName);
|
logger.Debug("Loading Cardigann definition " + file.FullName);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var DefinitionString = File.ReadAllText(file.FullName);
|
var DefinitionString = File.ReadAllText(file.FullName);
|
||||||
@@ -147,6 +146,7 @@ namespace Jackett.Common.Services
|
|||||||
|
|
||||||
indexers.Add(indexer.ID, indexer);
|
indexers.Add(indexer.ID, indexer);
|
||||||
}
|
}
|
||||||
|
logger.Info("Cardigann definitions loaded: " + string.Join(", ", indexers.Keys));
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Autofac;
|
using Autofac;
|
||||||
@@ -115,7 +116,8 @@ namespace Jackett.Server
|
|||||||
#if NET461
|
#if NET461
|
||||||
public void Configure(IApplicationBuilder app, IHostingEnvironment env, IApplicationLifetime applicationLifetime)
|
public void Configure(IApplicationBuilder app, IHostingEnvironment env, IApplicationLifetime applicationLifetime)
|
||||||
{
|
{
|
||||||
applicationLifetime.ApplicationStopping.Register(OnShutdown);
|
applicationLifetime.ApplicationStarted.Register(OnStarted);
|
||||||
|
applicationLifetime.ApplicationStopped.Register(OnStopped);
|
||||||
Helper.applicationLifetime = applicationLifetime;
|
Helper.applicationLifetime = applicationLifetime;
|
||||||
app.UseResponseCompression();
|
app.UseResponseCompression();
|
||||||
|
|
||||||
@@ -154,7 +156,8 @@ namespace Jackett.Server
|
|||||||
#else
|
#else
|
||||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IHostApplicationLifetime applicationLifetime)
|
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IHostApplicationLifetime applicationLifetime)
|
||||||
{
|
{
|
||||||
applicationLifetime.ApplicationStopping.Register(OnShutdown);
|
applicationLifetime.ApplicationStarted.Register(OnStarted);
|
||||||
|
applicationLifetime.ApplicationStopped.Register(OnStopped);
|
||||||
Helper.applicationLifetime = applicationLifetime;
|
Helper.applicationLifetime = applicationLifetime;
|
||||||
app.UseResponseCompression();
|
app.UseResponseCompression();
|
||||||
|
|
||||||
@@ -197,11 +200,12 @@ namespace Jackett.Server
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
private static void OnStarted()
|
||||||
|
|
||||||
private void OnShutdown()
|
|
||||||
{
|
{
|
||||||
//this code is called when the application stops
|
var elapsed = (DateTime.Now - Process.GetCurrentProcess().StartTime).TotalSeconds;
|
||||||
|
Helper.Logger.Info($"Jackett startup finished in {elapsed:0.000} s");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void OnStopped() => Helper.Logger.Info($"Jackett stopped");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user