Program.cs file or in your appsettings.json file.
Parameters
The following configuration parameters are available. OnlyClientId and Env are required.
| Parameter | Description | Type |
|---|---|---|
ClientId | Client ID for your application. Find it on the Setup instructions page for your app. | string |
Env | Name of the environment, e.g. prod or dev. The environment will be automatically created if it doesn’t exist. | string |
RequestLogging | Configuration for request logging. See table below. | RequestLoggingOptions |
RequestLogging parameter is an object with the following properties:
| Parameter | Description | Type | Default |
|---|---|---|---|
Enabled | Whether request logging is enabled. | bool | false |
IncludeQueryParams | Whether to include query parameters in the logs. If disabled, these will be stripped from the request URLs logged. | bool | true |
IncludeRequestHeaders | Whether to include request headers in the logs. Default masking for common sensitive headers (e.g. Authorization) applies. | bool | false |
IncludeRequestBody | Whether to include the request body in the logs. Only JSON and text are supported, up to 50 KB. | bool | false |
IncludeResponseHeaders | Whether to include response headers in the logs. | bool | true |
IncludeResponseBody | Whether to include the response body in the logs. Only JSON and text are supported, up to 50 KB. | bool | false |
IncludeException | Whether to include exception details in the logs. | bool | true |
CaptureLogs | Whether to capture application logs emitted during request handling. | bool | false |
CaptureTraces | Whether to enable tracing using System.Diagnostics. | bool | false |
QueryParamMaskPatterns | List of regular expressions for matching query parameters to mask. These are in addition to the default masking patterns. | List<string> | [] |
HeaderMaskPatterns | List of regular expressions for matching headers to mask. These are in addition to the default masking patterns. | List<string> | [] |
BodyFieldMaskPatterns | List of regular expressions for matching request/response body fields to mask. These are in addition to the default masking patterns. | List<string> | [] |
PathExcludePatterns | List of regular expressions for matching paths to exclude from logging. | List<string> | [] |
MaskRequestBody | Function to mask sensitive data in the request body. Return null to mask the whole body. | Func<Request, byte[]?> | - |
MaskResponseBody | Function to mask sensitive data in the response body. Return null to mask the whole body. | Func<Request, Response, byte[]?> | - |
ShouldExclude | Function to determine whether a request should be excluded from logging. Return true to exclude the request. | Func<Request, Response, bool> | - |