aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJP Dillingham <jpdillingham@gmail.com>2021-10-08 07:38:18 -0500
committerJP Dillingham <jpdillingham@gmail.com>2021-10-08 07:38:18 -0500
commit8aee9b84a34dd73d5ef42c39e735d3b8d053fab6 (patch)
treeac04d48081b1c5ef4370bd2143b893a57462ca35
parent9dea3b01c4b8b6bd599ec1c7703c66c00ef58fff (diff)
parent2a26742088bd5951dcd545582d44ac5a8b381d5d (diff)
downloadslskd-8aee9b84a34dd73d5ef42c39e735d3b8d053fab6.tar.gz
Merge remote-tracking branch 'origin/master' into logs
-rw-r--r--src/slskd/Program.cs26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/slskd/Program.cs b/src/slskd/Program.cs
index b5e628cc..2646a780 100644
--- a/src/slskd/Program.cs
+++ b/src/slskd/Program.cs
@@ -222,6 +222,18 @@ namespace slskd
return;
}
+ try
+ {
+ VerifyDirectory(OptionsAtStartup.Directories.App, createIfMissing: true, verifyWriteable: true);
+ VerifyDirectory(OptionsAtStartup.Directories.Incomplete, createIfMissing: true, verifyWriteable: true);
+ VerifyDirectory(OptionsAtStartup.Directories.Downloads, createIfMissing: true, verifyWriteable: true);
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine($"Filesystem exception: {ex.Message}");
+ return;
+ }
+
Log.Logger = (OptionsAtStartup.Debug ? new LoggerConfiguration().MinimumLevel.Debug() : new LoggerConfiguration().MinimumLevel.Information())
.MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
.MinimumLevel.Override("System.Net.Http.HttpClient", OptionsAtStartup.Debug ? LogEventLevel.Warning : LogEventLevel.Fatal)
@@ -235,7 +247,7 @@ namespace slskd
outputTemplate: (OptionsAtStartup.Debug ? "[{SourceContext}] [{SoulseekContext}] " : string.Empty) + "[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}")
.WriteTo.Async(config =>
config.File(
- Path.Combine(AppContext.BaseDirectory, "logs", $"{AppName}-.log"),
+ Path.Combine(OptionsAtStartup.Directories.App, "logs", $"{AppName}-.log"),
outputTemplate: (OptionsAtStartup.Debug ? "[{SourceContext}] " : string.Empty) + "[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}",
rollingInterval: RollingInterval.Day))
.WriteTo.Conditional(
@@ -260,18 +272,6 @@ namespace slskd
var logger = Log.ForContext(typeof(Program));
- try
- {
- VerifyDirectory(OptionsAtStartup.Directories.App, createIfMissing: true, verifyWriteable: true);
- VerifyDirectory(OptionsAtStartup.Directories.Incomplete, createIfMissing: true, verifyWriteable: true);
- VerifyDirectory(OptionsAtStartup.Directories.Downloads, createIfMissing: true, verifyWriteable: true);
- }
- catch (Exception ex)
- {
- logger.Error(ex, "Filesystem exception: {Message}", ex.Message);
- return;
- }
-
if (!OptionsAtStartup.NoLogo)
{
PrintLogo(Version);