EonaCat.Web.Tracer
2.0.2
Prefix Reserved
dotnet add package EonaCat.Web.Tracer --version 2.0.2
NuGet\Install-Package EonaCat.Web.Tracer -Version 2.0.2
<PackageReference Include="EonaCat.Web.Tracer" Version="2.0.2" />
<PackageVersion Include="EonaCat.Web.Tracer" Version="2.0.2" />
<PackageReference Include="EonaCat.Web.Tracer" />
paket add EonaCat.Web.Tracer --version 2.0.2
#r "nuget: EonaCat.Web.Tracer, 2.0.2"
#addin nuget:?package=EonaCat.Web.Tracer&version=2.0.2
#tool nuget:?package=EonaCat.Web.Tracer&version=2.0.2
EonaCat.Web.Tracer
EonaCat Web Tracer is a middleware to log every Http request/response to a database for tracing.
Make sure to set the username and the password for the dashboard:
WebTracerMiddleware.DashboardUsername = "admin";
WebTracerMiddleware.DashboardPassword = "traces";
To add the Middleware use the following code:
Configure method in the Startup.cs file:
app.UseWebTracer();
Add Razor View Locations in Startup.cs (or Program.cs for .NET 6+): You need to tell the framework to look for Razor Pages in the library. This can be done by adding the following in the ConfigureServices method of Startup.cs or Program.cs:
services.AddRazorPages()
.AddApplicationPart(typeof(DashboardController).Assembly);
Ensure Razor Pages are Available in the Application: In the Configure method of your Startup.cs (or Program.cs), make sure that you enable Razor Pages routing:
app.UseEndpoints(endpoints =>
{
endpoints.MapRazorPages(); // To map Razor Pages from the library
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Index}/{action=Index}/{id?}");
});
ConfigureServices method in the Startup.cs file:
services.AddWebTracer();
As a default the database is located at the current directory of the executable in the folder named 'EonaCat.Web.Tracer'
The following eventhandlers are available:
OnException OnSuspiciousActivityDetected OnHighResponseLatency OnRateLimited
To use the eventhandlers you need to add the following code:
WebTracerMiddleware.OnException += (sender, args) =>
{
// Your code here
};
WebTracerMiddleware.OnSuspiciousActivityDetected += (sender, args) =>
{
// Your code here
};
WebTracerMiddleware.OnHighResponseLatency += (sender, args) =>
{
// Your code here
};
WebTracerMiddleware.OnRateLimited += (sender, args) =>
{
// Your code here
};
You also have syslog support so you can send the logs to a syslog server.
You can add a syslog server by adding the following code:
WebtracerMiddleware.AddSyslogServer(new SyslogServerConfig
{
Host = "localhost", // optional (default: "localhost"))
Port = 514, // optional (default: 514))
IsEnabled = true, // optional (default: false))
Facility = "user", // optional (default: "user"))
IsTcp = true, // optional (default: false))
MaxUdpPacketSize = 1400, // optional (default: 1400)))
});
You could also send to a syslog server by adding the following code:
WebtracerMiddleware.SyslogServers = new List<SyslogServerConfig>
{
new SyslogServerConfig("localhost", 514, isEnabled: true)
};
To remove a syslog server you can use the following code:
WebtracerMiddleware.RemoveSyslogServer("localhost", 514);
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net8.0
- EonaCat.Json (>= 1.1.9)
- Microsoft.EntityFrameworkCore (>= 9.0.2)
- Microsoft.EntityFrameworkCore.Sqlite (>= 9.0.2)
-
net9.0
- EonaCat.Json (>= 1.1.9)
- Microsoft.EntityFrameworkCore (>= 9.0.2)
- Microsoft.EntityFrameworkCore.Sqlite (>= 9.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.