< Summary - Kestrun — Combined Coverage

Information
Class: Kestrun.Middleware.CommonAccessLogOptions
Assembly: Kestrun
File(s): /home/runner/work/Kestrun/Kestrun/src/CSharp/Kestrun/Middleware/CommonAccessLogOptions.cs
Tag: Kestrun/Kestrun@2d87023b37eb91155071c91dd3d6a2eeb3004705
Line coverage
100%
Covered lines: 9
Uncovered lines: 0
Coverable lines: 9
Total lines: 63
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

Coverage history

Coverage history 0 25 50 75 100 10/13/2025 - 16:52:37 Line coverage: 100% (9/9) Total lines: 63 Tag: Kestrun/Kestrun@10d476bee71c71ad215bb8ab59f219887b5b4a5e

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Level()100%11100%
get_IncludeQueryString()100%11100%
get_IncludeProtocol()100%11100%
get_IncludeElapsedMilliseconds()100%11100%
get_UseUtcTimestamp()100%11100%
get_TimestampFormat()100%11100%
get_ClientAddressHeader()100%11100%
get_TimeProvider()100%11100%
get_Logger()100%11100%

File(s)

/home/runner/work/Kestrun/Kestrun/src/CSharp/Kestrun/Middleware/CommonAccessLogOptions.cs

#LineLine coverage
 1using Serilog.Events;
 2
 3namespace Kestrun.Middleware;
 4
 5/// <summary>
 6/// Options controlling the behaviour of the <see cref="CommonAccessLogMiddleware"/>.
 7/// </summary>
 8public sealed class CommonAccessLogOptions
 9{
 10    /// <summary>
 11    /// The default timestamp format used by Apache HTTPD common/combined logs.
 12    /// </summary>
 13    public const string DefaultTimestampFormat = "dd/MMM/yyyy:HH:mm:ss zzz";
 14
 15    /// <summary>
 16    /// Gets or sets the log level used when writing access log entries.
 17    /// </summary>
 2918    public LogEventLevel Level { get; set; } = LogEventLevel.Information;
 19
 20    /// <summary>
 21    /// Gets or sets a value indicating whether the request query string should be included in the request line.
 22    /// </summary>
 2623    public bool IncludeQueryString { get; set; } = true;
 24
 25    /// <summary>
 26    /// Gets or sets a value indicating whether the request protocol should be included in the request line.
 27    /// </summary>
 2628    public bool IncludeProtocol { get; set; } = true;
 29
 30    /// <summary>
 31    /// Gets or sets a value indicating whether the elapsed request time in milliseconds should be appended to the log e
 32    /// </summary>
 633    public bool IncludeElapsedMilliseconds { get; set; }
 34        = false;
 35
 36    /// <summary>
 37    /// Gets or sets a value indicating whether the timestamp should be written using UTC time rather than the server lo
 38    /// </summary>
 539    public bool UseUtcTimestamp { get; set; }
 40        = false;
 41
 42    /// <summary>
 43    /// Gets or sets the timestamp format used when rendering the access log entry.
 44    /// </summary>
 2945    public string TimestampFormat { get; set; } = DefaultTimestampFormat;
 46
 47    /// <summary>
 48    /// Gets or sets the name of the HTTP header that should be consulted for the client address
 49    /// (for example <c>X-Forwarded-For</c>). When the header is missing the connection remote address is used.
 50    /// </summary>
 551    public string? ClientAddressHeader { get; set; }
 52
 53    /// <summary>
 54    /// Gets or sets the time provider used when rendering timestamps.
 55    /// </summary>
 2456    public TimeProvider TimeProvider { get; set; } = TimeProvider.System;
 57
 58    /// <summary>
 59    /// Gets or sets the Serilog logger used to emit access log entries. When not specified the
 60    /// middleware will use the application logger registered in dependency injection.
 61    /// </summary>
 662    public Serilog.ILogger? Logger { get; set; }
 63}