| | | 1 | | namespace ProjectTemplate.Web.Options; |
| | | 2 | | |
| | | 3 | | /// <summary> |
| | | 4 | | /// Options controlling structured HTTP request logging behavior. |
| | | 5 | | /// </summary> |
| | | 6 | | public sealed class ApplicationRequestLoggingOptions |
| | | 7 | | { |
| | | 8 | | /// <summary> |
| | | 9 | | /// Gets the configuration section name used to bind request logging settings. |
| | | 10 | | /// </summary> |
| | 188 | 11 | | public static string SectionName { get; internal set; } = "ProjectTemplate:RequestLogging"; |
| | | 12 | | |
| | | 13 | | /// <summary> |
| | | 14 | | /// Gets or sets a value indicating whether structured request logging is enabled. |
| | | 15 | | /// </summary> |
| | 738 | 16 | | public bool Enabled { get; set; } = true; |
| | | 17 | | |
| | | 18 | | /// <summary> |
| | | 19 | | /// Gets or sets the request/response header used for request correlation. |
| | | 20 | | /// </summary> |
| | 1286 | 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> |
| | 372 | 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> |
| | 678 | 32 | | public bool IncludeUserName { get; set; } = true; |
| | | 33 | | |
| | | 34 | | /// <summary> |
| | | 35 | | /// Gets or sets a value indicating whether the remote IP address should be logged. |
| | | 36 | | /// </summary> |
| | 678 | 37 | | public bool IncludeRemoteIpAddress { get; set; } = true; |
| | | 38 | | |
| | | 39 | | /// <summary> |
| | | 40 | | /// Gets or sets path prefixes that should be excluded from normal request logging. |
| | | 41 | | /// Matching requests are logged at Verbose level so the default sinks suppress them. |
| | | 42 | | /// </summary> |
| | 960 | 43 | | public List<string> ExcludedPathPrefixes { get; set; } = |
| | 306 | 44 | | [ |
| | 306 | 45 | | "/health", |
| | 306 | 46 | | "/metrics", |
| | 306 | 47 | | "/favicon.ico", |
| | 306 | 48 | | "/css", |
| | 306 | 49 | | "/js", |
| | 306 | 50 | | "/lib", |
| | 306 | 51 | | "/_framework" |
| | 306 | 52 | | ]; |
| | | 53 | | } |