LogFlake Client ASP.NET Core
License
—
Deps
6
Install Size
—
Vulns
✓ 0
Published
Nov 21, 2025
$ dotnet add package LogFlake.Client.AspNetCoreThis repository contains the sources for the client-side components of the LogFlake product suite for applications logs and performance collection for ASP.NET applications.
| NuGet Package Name | Version | Downloads |
|---|---|---|
| LogFlake.Client.AspNetCore |
This package depends on LogFlake.Client.NetCore. Please refer to the documentation of that package for usage instructions.
secrets.json file:"LogFlakeMiddlewareSettings": {
"LogRequest": true,
"LogResponse": true,
"LogNotFoundErrors": true
},
All of them are optional, if a boolean property it's missing, the default value is false;
ConfigureLogFlakeMiddlewareOptions) that implements IConfigureOptions<LogFlakeMiddlewareOptions> and configure each property as preferred:GlobalExceptionHandler: This flag let you specify if you want the LogFlakeMiddleware try & catch all the unhandled exceptions in your application. When the flag is set to true, the next method will be surrounded by a try / catch block. In case of any unhandled exception, the OnError will be called.OnError: This function will be called when the middleware encounters a Status Code that is greater or equal to 400, and the Body's response is empty, so you can customize the response depending on the case;GetPerformanceMonitorLabel: For ASP.NET applications, the performance label should be a string representing the Uri with placeholders for variables instead of actual values. Due some limitations of the .NET Standard framework, the Endpoint of the HttpContext cannot be easily accessed inside a Class Library. But you can write your own implementation in order to get a performance label.
ℹ️ Suggestion: Use the RoutePattern property of the RouteEndpoint instance taken from httpContext.GetEndpoint().IgnoreLogProcessing: This method will be invocated on each invocation of the middleware to understand if the current request has to be logged or not. It's recommended to use the LogFlakeIgnoreAttribute on the action you want to ignore and check in this method if it's present or not.services.AddSingleton<IConfigureOptions<LogFlakeMiddlewareOptions>, ConfigureLogFlakeMiddlewareOptions>();
services.AddLogFlake(configuration);, register LogFlakeMiddleware by adding the following line of code:services.ConfigureLogFlakeMiddlewareOptions(configuration);
Note: The middleware registration will also require a
CorrelationId, by default the middleware uses aGuid. You can customize this behavior passing aCorrelationTypeto the method above, you can also choose a TraceIdentifier or a CustomCorrelationId.
Note: In order to use a Custom
CorrelationIdyou must implement and register (as a AddScoped)ICorrelationServiceinterface.
WebApplicationapp.UseLogFlakeMiddleware();
IParameterService interface and register as a Scoped before the services.ConfigureLogFlakeMiddlewareOptions(configuration); invocation.