Make the first log message the server version

This commit is contained in:
Jordan Brown
2020-07-11 10:03:30 -04:00
parent ec48e20bed
commit 308e71d8c9
@@ -28,6 +28,11 @@ namespace Tgstation.Server.Host.Components
/// <inheritdoc />
public Task Ready => readyTcs.Task;
/// <summary>
/// The <see cref="Lazy{T}"/> <see cref="IRestartRegistration"/> for the <see cref="InstanceManager"/>;
/// </summary>
readonly Lazy<IRestartRegistration> lazyRestartRegistration;
/// <summary>
/// The <see cref="IInstanceFactory"/> for the <see cref="InstanceManager"/>
/// </summary>
@@ -155,7 +160,7 @@ namespace Tgstation.Server.Host.Components
generalConfiguration = generalConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(generalConfigurationOptions));
this.logger = logger ?? throw new ArgumentNullException(nameof(logger));
serverControl.RegisterForRestart(this);
lazyRestartRegistration = new Lazy<IRestartRegistration>(() => serverControl.RegisterForRestart(this));
instances = new Dictionary<long, IInstance>();
bridgeHandlers = new Dictionary<string, IBridgeHandler>();
@@ -174,6 +179,10 @@ namespace Tgstation.Server.Host.Components
foreach (var I in instances)
I.Value.Dispose();
lazyRestartRegistration.Value.Dispose();
logger.LogInformation("Server shutdown");
}
/// <inheritdoc />
@@ -287,6 +296,10 @@ namespace Tgstation.Server.Host.Components
{
logger.LogInformation(assemblyInformationProvider.VersionString);
// we do this here because making the restart registration triggers a trace log message
// The above log message should be the first one one startup
var _ = lazyRestartRegistration.Value;
try
{
generalConfiguration.CheckCompatibility(logger);