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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EonaCat.Web.Tracer" Version="2.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="EonaCat.Web.Tracer" Version="2.0.2" />
                    
Directory.Packages.props
<PackageReference Include="EonaCat.Web.Tracer" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add EonaCat.Web.Tracer --version 2.0.2
                    
#r "nuget: EonaCat.Web.Tracer, 2.0.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=EonaCat.Web.Tracer&version=2.0.2
                    
Install EonaCat.Web.Tracer as a Cake Addin
#tool nuget:?package=EonaCat.Web.Tracer&version=2.0.2
                    
Install EonaCat.Web.Tracer as a Cake Tool

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.2 169 3/10/2025
2.0.1 162 3/10/2025
2.0.0 147 3/8/2025
1.1.9 111 10/22/2024