mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 22:44:29 +01:00
Fix missing logs
This commit is contained in:
@@ -15,9 +15,14 @@ namespace BTCPayServer.Logging
|
|||||||
}
|
}
|
||||||
public static void Configure(ILoggerFactory factory)
|
public static void Configure(ILoggerFactory factory)
|
||||||
{
|
{
|
||||||
Configuration = factory.CreateLogger("Configuration");
|
if (factory == null)
|
||||||
PayServer = factory.CreateLogger("PayServer");
|
Configure(new FuncLoggerFactory(n => NullLogger.Instance));
|
||||||
Events = factory.CreateLogger("Events");
|
else
|
||||||
|
{
|
||||||
|
Configuration = factory.CreateLogger("Configuration");
|
||||||
|
PayServer = factory.CreateLogger("PayServer");
|
||||||
|
Events = factory.CreateLogger("Events");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public static ILogger Configuration
|
public static ILogger Configuration
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -31,9 +31,14 @@ namespace BTCPayServer
|
|||||||
var logger = loggerFactory.CreateLogger("Configuration");
|
var logger = loggerFactory.CreateLogger("Configuration");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
// This is the only way toat LoadArgs can print to console. Because LoadArgs is called by the HostBuilder before Logs.Configure is called
|
||||||
var conf = new DefaultConfiguration() { Logger = logger }.CreateConfiguration(args);
|
var conf = new DefaultConfiguration() { Logger = logger }.CreateConfiguration(args);
|
||||||
if (conf == null)
|
if (conf == null)
|
||||||
return;
|
return;
|
||||||
|
Logs.Configure(loggerFactory);
|
||||||
|
new BTCPayServerOptions().LoadArgs(conf);
|
||||||
|
Logs.Configure(null);
|
||||||
|
/////
|
||||||
|
|
||||||
host = new WebHostBuilder()
|
host = new WebHostBuilder()
|
||||||
.UseKestrel()
|
.UseKestrel()
|
||||||
@@ -64,6 +69,8 @@ namespace BTCPayServer
|
|||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
processor.Dispose();
|
processor.Dispose();
|
||||||
|
if(host == null)
|
||||||
|
Logs.Configuration.LogError("Configuration error");
|
||||||
if (host != null)
|
if (host != null)
|
||||||
host.Dispose();
|
host.Dispose();
|
||||||
loggerProvider.Dispose();
|
loggerProvider.Dispose();
|
||||||
|
|||||||
Reference in New Issue
Block a user