aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJP Dillingham <jpdillingham@gmail.com>2021-10-08 07:37:53 -0500
committerGitHub <noreply@github.com>2021-10-08 07:37:53 -0500
commit2a26742088bd5951dcd545582d44ac5a8b381d5d (patch)
treeb5015d00172d4baa7d25b3362ccbd14f6a6de354 /src
parent228cd7f97761137bde191d45c1771879a8d45de3 (diff)
parent4a2e443b545698466db86395fa142b84d717b450 (diff)
downloadslskd-2a26742088bd5951dcd545582d44ac5a8b381d5d.tar.gz
Merge pull request #209 from Exouxas/master
Changed path of logs from "exe path" to "application path"
Diffstat (limited to 'src')
-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);