< Summary

Information
Class: ProjectTemplate.Web.Options.ApplicationRequestLoggingOptions
Assembly: ProjectTemplate.Web
File(s): /home/runner/work/NetCoreApplicationTemplate/NetCoreApplicationTemplate/src/ProjectTemplate.Web/Options/ApplicationRequestLoggingOptions.cs
Line coverage
100%
Covered lines: 9
Uncovered lines: 0
Coverable lines: 9
Total lines: 67
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor()100%11100%

File(s)

/home/runner/work/NetCoreApplicationTemplate/NetCoreApplicationTemplate/src/ProjectTemplate.Web/Options/ApplicationRequestLoggingOptions.cs

#LineLine coverage
 1namespace ProjectTemplate.Web.Options;
 2
 3/// <summary>
 4/// Options controlling structured HTTP request logging behavior.
 5/// </summary>
 6public sealed class ApplicationRequestLoggingOptions
 7{
 8    /// <summary>
 9    /// Gets the configuration section name used to bind request logging settings.
 10    /// </summary>
 11    public const string SectionName = "ProjectTemplate:RequestLogging";
 12
 13    /// <summary>
 14    /// Gets or sets a value indicating whether structured request logging is enabled.
 15    /// </summary>
 16    public bool Enabled { get; set; } = true;
 17
 18    /// <summary>
 19    /// Gets or sets the request/response header used for request correlation.
 20    /// </summary>
 21    public string CorrelationHeaderName { get; set; } = "X-Correlation-ID";
 22
 23    /// <summary>
 24    /// Gets or sets a value indicating whether the query string should be logged.
 25    /// Disabled by default because query strings may contain sensitive values.
 26    /// </summary>
 27    public bool IncludeQueryString { get; set; }
 28
 29    /// <summary>
 30    /// Gets or sets a value indicating whether authenticated user names should be logged.
 31    /// </summary>
 32    /// <remarks>
 33    /// Disabled by default. A user name identifies a person, and request logs are typically shipped and retained for
 34    /// longer than the data they describe. Enable this when the application has decided that request attribution is
 35    /// needed and its log retention accounts for personal data.
 36    /// </remarks>
 37    public bool IncludeUserName { get; set; }
 38
 39    /// <summary>
 40    /// Gets or sets a value indicating whether the remote IP address should be logged.
 41    /// </summary>
 42    /// <remarks>
 43    /// Disabled by default for the same reason as <see cref="IncludeUserName" />. A client IP address is treated as
 44    /// personal data under several privacy regimes. Enable this when incident response or abuse handling needs it,
 45    /// and note that the value is only meaningful once forwarded headers are configured with trusted proxies.
 46    /// </remarks>
 47    public bool IncludeRemoteIpAddress { get; set; }
 48
 49    /// <summary>
 50    /// Gets or sets path prefixes that should be excluded from normal request logging.
 51    /// Matching requests are logged at Verbose level so the default sinks suppress them.
 52    /// </summary>
 53    /// <remarks>
 54    /// A configured list replaces these defaults rather than extending them. A blank configured entry is ignored, so a
 55    /// later configuration source can remove an inherited entry by overriding its index with an empty value.
 56    /// </remarks>
 57    public List<string> ExcludedPathPrefixes { get; set; } =
 23058    [
 23059        "/health",
 23060        "/metrics",
 23061        "/favicon.ico",
 23062        "/css",
 23063        "/js",
 23064        "/lib",
 23065        "/_framework"
 23066    ];
 67}

Methods/Properties

.ctor()