InterlockLedger.WatchDog
2.0.1
See the version list below for details.
dotnet add package InterlockLedger.WatchDog --version 2.0.1
NuGet\Install-Package InterlockLedger.WatchDog -Version 2.0.1
<PackageReference Include="InterlockLedger.WatchDog" Version="2.0.1" />
paket add InterlockLedger.WatchDog --version 2.0.1
#r "nuget: InterlockLedger.WatchDog, 2.0.1"
// Install InterlockLedger.WatchDog as a Cake Addin #addin nuget:?package=InterlockLedger.WatchDog&version=2.0.1 // Install InterlockLedger.WatchDog as a Cake Tool #tool nuget:?package=InterlockLedger.WatchDog&version=2.0.1
InterlockLedger.WatchDog
Introduction
InterlockLedger.WatchDog is a Realtime Message, Event, HTTP (Request & Response) and Exception logger and viewer for ASP.Net 6 Web Apps and APIs. It allows developers log and view messages, events, http requests made to their web application and also exception caught during runtime in their web applications, all in Realtime.
It leverages SignalR
for real-time monitoring and LiteDb
a Serverless MongoDB-like database with no configuration.
General Features
- RealTime HTTP Request and Response Logger
- RealTime Exception Logger
- In-code message and event logging
- User Friendly Logger Views
- Search Option for HTTP and Exception Logs
- Filtering Option for HTTP Logs using HTTP Methods and StatusCode
- Logger View Authentication
- Auto Clear Logs Option
- In-code logger for messages and events
What's New
- Specify folder to store log database
Support
- .NET 6.0 and newer
Installation
Install via .NET CLI
dotnet add package InterlockLedger.WatchDog.NET --version 1.0.3
Install via Package Manager
Install-Package InterlockLedger.WatchDog.NET --version 1.0.3
Usage
To enable InterlockLedger.WatchDog to listen for requests, use the WatchDog middleware provided by WatchDog.
Add WatchDog Namespace in Startup.cs
using WatchDog;
Register WatchDog service in Startup.cs
under ConfigureService()
services.AddWatchDogServices();
Setup AutoClear Logs Optional
This clears the logs after a specific duration.
services.AddWatchDogServices(opt =>
{
opt.UseAutoClear = true;
});
NOTE When
UseAutoClear = true
Default Schedule Time is set to Weekly, override the settings like below:
services.AddWatchDogServices(opt =>
{
opt.UseAutoClear = true;
opt.ClearTimeSchedule = WatchDogAutoClearScheduleEnum.Monthly;
});
Add WatchDog middleware in the HTTP request pipeline in Startup.cs
under Configure()
NOTE Add Authentication option like below:
Important
This authentication information (Username and Password) will be used to access the log viewer.
app.UseWatchDog(opt =>
{
opt.WatchPageUsername = "admin";
opt.WatchPagePassword = "Qwerty@123";
});
NOTE If your project uses authentication, then
app.UseWatchDog();
should come before app.UseRouting(), app.UseAuthentication(), app.UseAuthorization(), app.UseEndpoints() in that order
Add list of routes you want to ignore by the logger: Optional
List of routes, paths or specific strings to be ignored should be a comma separated string like below.
app.UseWatchDog(opt =>
{
opt.WatchPageUsername = "admin";
opt.WatchPagePassword = "Qwerty@123";
opt.Blacklist = "Test/testPost, weatherforecast";
});
Activate WatchDog Exception Logger Optional
This is used to log in-app exceptions that occur during a particular HTTP request.
NOTE Add the main WatchDog Middleware turning the LogExceptions option on.
app.UseWatchDog(opt =>
{
opt.WatchPageUsername = "admin";
opt.WatchPagePassword = "Qwerty@123";
opt.LogExceptions = true;
});
Log Messages/Events
WatchLogger.Log("...TestGet Started...");
View Logs and Exception
Start your server and head to /watchdog
to view the logs.
Example: https://myserver.com/watchdog or https://localhost:[your-port]/watchdog
Still confused? Check out the implementation in the WatchDogCompleteApiNet6 folder.
Contribution
Feel like something is missing? Fork the repo and send a PR.
Encountered a bug? Fork the repo and send a PR.
Alternatively, open an issue and we'll get to it as soon as we can.
Credit
Kelechi Onyekwere - Github Twitter
Rafael Monoman Teixeira - Github
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
-
net6.0
- Dapper (>= 2.0.123)
- InterlockLedger.Commons (>= 2.3.0)
- LiteDB (>= 5.0.12)
- Microsoft.AspNetCore.Http (>= 2.2.2)
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2.0)
- Microsoft.AspNetCore.Mvc (>= 2.2.0)
- Microsoft.AspNetCore.SignalR (>= 1.1.0)
- Microsoft.AspNetCore.SignalR.Core (>= 1.1.0)
- Microsoft.AspNetCore.StaticFiles (>= 2.2.0)
- Microsoft.Extensions.FileProviders.Abstractions (>= 6.0.0)
- Microsoft.Extensions.FileProviders.Embedded (>= 6.0.9)
- Microsoft.Extensions.FileProviders.Physical (>= 6.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 6.0.2)
- Microsoft.IO.RecyclableMemoryStream (>= 2.2.1)
- Newtonsoft.Json (>= 13.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
new MapWatchDog for endpoint routing