diff options
| author | JP Dillingham <jpdillingham@gmail.com> | 2021-11-13 15:00:05 -0600 |
|---|---|---|
| committer | JP Dillingham <jpdillingham@gmail.com> | 2021-11-13 15:00:05 -0600 |
| commit | 7439e0ef4db92941455af3e4f5b4e3736a51d6dc (patch) | |
| tree | 952156033eefb28c9f8efb031cbcf5880f1af0b7 | |
| parent | e5405fe094855ab5cc927e556f257efe92c50add (diff) | |
| download | slskd-7439e0ef4db92941455af3e4f5b4e3736a51d6dc.tar.gz | |
add option to suppress HTTP logging
| -rw-r--r-- | config/slskd.example.yml | 1 | ||||
| -rw-r--r-- | src/slskd/Options.cs | 9 | ||||
| -rw-r--r-- | src/slskd/Startup.cs | 5 |
3 files changed, 14 insertions, 1 deletions
diff --git a/config/slskd.example.yml b/config/slskd.example.yml index 643911e2..ce424595 100644 --- a/config/slskd.example.yml +++ b/config/slskd.example.yml @@ -25,6 +25,7 @@ # password: ~ # url_base: / # content_path: wwwroot +# logging: false # authentication: # disable: false # username: slskd diff --git a/src/slskd/Options.cs b/src/slskd/Options.cs index 71c341e9..0d487cc2 100644 --- a/src/slskd/Options.cs +++ b/src/slskd/Options.cs @@ -692,6 +692,15 @@ namespace slskd public string ContentPath { get; private set; } = "wwwroot"; /// <summary> + /// Gets a value indicating whether HTTP request logging should be enabled. + /// </summary> + [Argument(default, "http-logging")] + [EnvironmentVariable("HTTP_LOGGING")] + [Description("enable http request logging")] + [RequiresRestart] + public bool Logging { get; private set; } = false; + + /// <summary> /// Gets authentication options. /// </summary> [Validate] diff --git a/src/slskd/Startup.cs b/src/slskd/Startup.cs index 98deac0d..a8b64305 100644 --- a/src/slskd/Startup.cs +++ b/src/slskd/Startup.cs @@ -324,7 +324,10 @@ namespace slskd logger.Information("Publishing Prometheus metrics to /metrics"); } - app.UseSerilogRequestLogging(); + if (OptionsAtStartup.Web.Logging) + { + app.UseSerilogRequestLogging(); + } app.UseAuthentication(); |
