-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathRequestLoggingConfiguration.cs
More file actions
42 lines (38 loc) · 1.83 KB
/
RequestLoggingConfiguration.cs
File metadata and controls
42 lines (38 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System.Collections.Generic;
using System.Linq;
namespace APIMatic.Core.Utilities.Logger.Configuration
{
/// <summary>
/// Represents the configuration settings for logging HTTP requests.
/// </summary>
public class RequestLoggingConfiguration : HttpLoggingConfiguration
{
/// <summary>
/// Gets or sets a value indicating whether to include the query string in the logged path of HTTP requests.
/// </summary>
public bool IncludeQueryInPath { get; }
public RequestLoggingConfiguration(bool body, bool headers, IReadOnlyCollection<string> headersToInclude,
IReadOnlyCollection<string> headersToExclude, IReadOnlyCollection<string> headersToUnmask,
bool includeQueryInPath) : base(body, headers, headersToInclude, headersToExclude, headersToUnmask)
{
IncludeQueryInPath = includeQueryInPath;
}
internal static RequestLoggingConfiguration Default() =>
new RequestLoggingConfiguration(
false,
false,
Enumerable.Empty<string>().ToList(),
Enumerable.Empty<string>().ToList(),
Enumerable.Empty<string>().ToList(),
false);
public static RequestLoggingConfiguration Builder(bool logBody, bool logHeaders, bool includeQueryInPath,
IReadOnlyCollection<string> headersToInclude, IReadOnlyCollection<string> headersToExclude,
IReadOnlyCollection<string> headersToUnmask) =>
new RequestLoggingConfiguration(logBody,
logHeaders,
headersToInclude ?? Enumerable.Empty<string>().ToList(),
headersToExclude ?? Enumerable.Empty<string>().ToList(),
headersToUnmask ?? Enumerable.Empty<string>().ToList(),
includeQueryInPath);
}
}