aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJP Dillingham <jpdillingham@gmail.com>2021-01-16 17:28:09 -0600
committerJP Dillingham <jpdillingham@gmail.com>2021-01-16 17:28:09 -0600
commitcc1381416d3bd71a9c77ff5b8793f33953f09ac6 (patch)
tree3ab729fdf3e4091521e0ae5cb1bd688bcb52165b
parent38edf59f32fb123d90f7b903edd3ddbbfab0d614 (diff)
downloadslskd-cc1381416d3bd71a9c77ff5b8793f33953f09ac6.tar.gz
log instead of console.write
-rw-r--r--src/slskd/Startup.cs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/slskd/Startup.cs b/src/slskd/Startup.cs
index 6f5bc604..61993997 100644
--- a/src/slskd/Startup.cs
+++ b/src/slskd/Startup.cs
@@ -29,6 +29,7 @@
using System.Collections.Concurrent;
using Serilog;
using Serilog.Events;
+ using Microsoft.Extensions.Logging;
public class Startup
{
@@ -178,6 +179,7 @@
public void Configure(
IApplicationBuilder app,
IWebHostEnvironment env,
+ ILoggerFactory loggerFactory,
IApiVersionDescriptionProvider provider,
ITransferTracker tracker,
IBrowseTracker browseTracker,
@@ -255,6 +257,8 @@
// begin SoulseekClient implementation
// ---------------------------------------------------------------------------------------------------------------------------------------------
+ var logger = loggerFactory.CreateLogger<Startup>();
+
var connectionOptions = new ConnectionOptions(
readBufferSize: ReadBufferSize,
writeBufferSize: WriteBufferSize,
@@ -369,14 +373,14 @@
Client.Disconnected += async (e, args) =>
{
- Console.WriteLine($"Disconnected from Soulseek server: {args.Message}");
+ logger.LogWarning("Disconnected from Soulseek server: {Message}", args.Message, args.Exception);
// don't reconnect if the disconnecting Exception is either of these types.
// if KickedFromServerException, another client was most likely signed in, and retrying will cause a connect loop.
// if ObjectDisposedException, the client is shutting down.
if (!(args.Exception is KickedFromServerException || args.Exception is ObjectDisposedException))
{
- Console.WriteLine($"Attepting to reconnect...");
+ logger.LogWarning("Attepting to reconnect...");
await Client.ConnectAsync(Username, Password);
}
};
@@ -386,7 +390,7 @@
await Client.ConnectAsync(Username, Password);
}).GetAwaiter().GetResult();
- Console.WriteLine($"Connected and logged in.");
+ logger.LogInformation("Connected and logged in as {Username}", Username);
}
/// <summary>