aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Program.cs
diff options
context:
space:
mode:
authorJP Dillingham <jpdillingham@gmail.com>2021-01-16 17:27:50 -0600
committerJP Dillingham <jpdillingham@gmail.com>2021-01-16 17:27:50 -0600
commit38edf59f32fb123d90f7b903edd3ddbbfab0d614 (patch)
tree49536e0d986a65f70e00cd47ffd0e6d06ac11fee /src/slskd/Program.cs
parent5be8b4db48c6812a137d62cddb5499d66b915ee6 (diff)
downloadslskd-38edf59f32fb123d90f7b903edd3ddbbfab0d614.tar.gz
rename logger config vars
Diffstat (limited to 'src/slskd/Program.cs')
-rw-r--r--src/slskd/Program.cs21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/slskd/Program.cs b/src/slskd/Program.cs
index 6e48b86a..44f52db9 100644
--- a/src/slskd/Program.cs
+++ b/src/slskd/Program.cs
@@ -15,8 +15,8 @@
{
public static bool Debug { get; private set; }
public static string InstanceName { get; private set; }
- public static bool EnableLoki { get; private set; }
- public static string LokiUrl { get; private set; }
+ public static bool LoggerLokiEnable { get; private set; }
+ public static string LoggerLokiUrl { get; private set; }
public static void Main(string[] args)
{
@@ -46,14 +46,15 @@
InstanceName = Environment.GetEnvironmentVariable("SLSKD_INSTANCE_NAME") ?? "default";
- LokiUrl = Environment.GetEnvironmentVariable("SLSKD_LOKI_URL");
- EnableLoki = !string.IsNullOrWhiteSpace(LokiUrl) && Environment.GetEnvironmentVariable("SLSKD_ENABLE_LOKI") != null;
+ LoggerLokiUrl = Environment.GetEnvironmentVariable("SLSKD_LOGGER_LOKI_URL");
+ LoggerLokiEnable = !string.IsNullOrWhiteSpace(LoggerLokiUrl) && Environment.GetEnvironmentVariable("SLSKD_LOGGER_LOKI_ENABLE") != null;
if (Debug)
{
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.MinimumLevel.Override("Microsoft", LogEventLevel.Information)
+ .Enrich.WithProperty("InstanceName", InstanceName)
.Enrich.WithProperty("ProcessId", processId)
.Enrich.WithProperty("RunId", runId)
.Enrich.FromLogContext()
@@ -65,9 +66,9 @@
outputTemplate: "[{SourceContext}] [{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}",
rollingInterval: RollingInterval.Day))
.WriteTo.Conditional(
- e => EnableLoki,
+ e => LoggerLokiEnable,
config => config.GrafanaLoki(
- LokiUrl,
+ LoggerLokiUrl ?? string.Empty,
outputTemplate: "[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}"))
.CreateLogger();
}
@@ -89,9 +90,9 @@
outputTemplate: "[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}",
rollingInterval: RollingInterval.Day))
.WriteTo.Conditional(
- e => EnableLoki,
+ e => LoggerLokiEnable,
config => config.GrafanaLoki(
- LokiUrl,
+ LoggerLokiUrl ?? string.Empty,
outputTemplate: "[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}"))
.CreateLogger();
}
@@ -104,9 +105,9 @@
logger.Information("Process ID: {ProcessId}", processId);
logger.Information("Run ID: {RunId}", runId);
- if (EnableLoki)
+ if (LoggerLokiEnable)
{
- logger.Information("Logging to Loki instance at {LokiUrl}", LokiUrl);
+ logger.Information("Logging to Loki instance at {LoggerLokiUrl}", LoggerLokiUrl);
}
try