{"id":13457945,"url":"https://github.com/IzyPro/WatchDog","last_synced_at":"2025-03-24T14:33:01.282Z","repository":{"id":40273871,"uuid":"453890467","full_name":"IzyPro/WatchDog","owner":"IzyPro","description":"WatchDog is a Realtime Message, Event, HTTP (Request \u0026 Response) and Exception logger and viewer for ASP.Net Core 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.","archived":false,"fork":false,"pushed_at":"2024-04-03T00:21:07.000Z","size":12713,"stargazers_count":570,"open_issues_count":7,"forks_count":81,"subscribers_count":13,"default_branch":"main","last_synced_at":"2024-05-16T12:32:37.141Z","etag":null,"topics":["devtools","dotnet","insights","logging","monitoring","package","web"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/IzyPro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-01-31T05:30:02.000Z","updated_at":"2024-05-28T17:14:26.556Z","dependencies_parsed_at":"2024-05-28T17:14:20.185Z","dependency_job_id":"b3220c79-8501-42f8-bce6-258e7f70c288","html_url":"https://github.com/IzyPro/WatchDog","commit_stats":{"total_commits":163,"total_committers":6,"mean_commits":"27.166666666666668","dds":0.4601226993865031,"last_synced_commit":"ac362d5ede088d2c817e0f5f98f16a847d9900bf"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IzyPro%2FWatchDog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IzyPro%2FWatchDog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IzyPro%2FWatchDog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IzyPro%2FWatchDog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IzyPro","download_url":"https://codeload.github.com/IzyPro/WatchDog/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245289842,"owners_count":20591144,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["devtools","dotnet","insights","logging","monitoring","package","web"],"created_at":"2024-07-31T09:00:40.303Z","updated_at":"2025-03-24T14:33:01.275Z","avatar_url":"https://github.com/IzyPro.png","language":"C#","readme":"# ![WatchDog Logo](https://github.com/IzyPro/WatchDog/blob/main/WatchDog/src/WatchPage/images/watchdogWhiteLogo.png)\n# WatchDog\n\n[![WatchDog](https://img.shields.io/badge/WatchDog-blueviolet)](https://github.com/IzyPro/WatchDog)\n[![Version](https://img.shields.io/nuget/vpre/WatchDog.NET?color=orange)](https://www.nuget.org/packages/WatchDog.NET#versions-tab)\n[![Downloads](https://img.shields.io/nuget/dt/WatchDog.NET?color=red)](https://www.nuget.org/packages/WatchDog.NET#versions-tab)\n[![MIT License](https://img.shields.io/github/license/IzyPro/WatchDog?color=Green)](https://github.com/IzyPro/WatchDog/blob/main/LICENSE) \n[![WatchDog](https://img.shields.io/twitter/url?style=social\u0026url=https%3A%2F%2Fgithub.com%2FIzyPro%2FWatchDog)](https://twitter.com/intent/tweet?hashtags=WatchDog\u0026original_referer=https%3A%2F%2Fdeveloper.twitter.com%2F\u0026ref_src=twsrc%5Etfw%7Ctwcamp%5Ebuttonembed%7Ctwterm%5Eshare%7Ctwgr%5E\u0026related=twitterapi%2Ctwitter\u0026text=Hello%2C%20world!%0DCheck%20out%20this%20awesome%20developer%20tool\u0026url=https%3A%2F%2Fgithub.com%2FIzyPro%2FWatchDog\u0026via=HQWatchdog)\n\n## Introduction\n\nWatchDog is a Realtime Message, Event, HTTP (Request \u0026 Response) and Exception logger and viewer for ASP.Net Core 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.\nIt leverages `SignalR` for real-time monitoring and `LiteDb` a Serverless MongoDB-like database with no configuration with the option of using your external databases (MSSQL, MySQl, Postgres, MongoDB).\n\n# ![Request \u0026 Response Viewer](https://github.com/IzyPro/WatchDog/blob/main/watchlog.png)\n\n## General Features\n\n- RealTime HTTP Request, Response, and Exception Logger\n- In-code message and event logging\n- User Friendly Logger Views\n- Search Option for HTTP and Exception Logs\n- Filtering Option for HTTP Logs using HTTP Methods and StatusCode\n- Logger View Authentication\n- Auto Clear Logs Option\n\n## What's New\n\n- Package upgrades for vulnerability patches\n\n### Breaking Changes\n\n- SqlDriverOption is now DbDriverOption (\u003e= v1.4.0)\n\n\n## Support\n- .NET Core 3.1 and newer\n\n## Installation\n\nInstall via .NET CLI\n\n```bash\ndotnet add package WatchDog.NET --version 1.4.12\n```\nInstall via Package Manager\n\n```bash\nInstall-Package WatchDog.NET --version 1.4.12\n```\n\n\n\n## Usage\nTo enable WatchDog to listen for requests, use the WatchDog middleware provided by WatchDog.\n\nAdd WatchDog Namespace in `Startup.cs`\n\n```c#\nusing WatchDog;\n```\n\n\n\n### Register WatchDog service in `Startup.cs` under `ConfigureService()`\n\n```c#\nservices.AddWatchDogServices();\n```\n\n\n\n### Setup AutoClear Logs `Optional`\nThis clears the logs after a specific duration.\n\u003e**NOTE**\n\u003eWhen `IsAutoClear = true`\n\u003eDefault Schedule Time is set to Weekly,  override the settings like below:\n\n\n```c#\nservices.AddWatchDogServices(opt =\u003e \n{ \n   opt.IsAutoClear = true;\n   opt.ClearTimeSchedule = WatchDogAutoClearScheduleEnum.Monthly;\n});\n```\n\n### Setup Logging to External Db (MSSQL, MySQL, PostgreSQL \u0026 MongoDb) `Optional`\nAdd Database Connection String and Choose DbDriver Option\n\n```c#\nservices.AddWatchDogServices(opt =\u003e \n{\n   opt.IsAutoClear = true; \n   opt.SetExternalDbConnString = \"Server=localhost;Database=testDb;User Id=postgres;Password=root;\"; \n   opt.DbDriverOption = WatchDogDbDriverEnum.PostgreSql; \n});\n```\n\n\n\n### Add WatchDog middleware in the HTTP request pipeline in `Startup.cs` under `Configure()`\n# ![Login page sample](https://github.com/IzyPro/WatchDog/blob/main/login.png)\n\n\u003e**NOTE**\n\u003eAdd Authentication option like below: `Important`\n\nThis authentication information (Username and Password) will be used to access the log viewer.\n\n```c#\napp.UseWatchDog(opt =\u003e \n{ \n   opt.WatchPageUsername = \"admin\"; \n   opt.WatchPagePassword = \"Qwerty@123\"; \n });\n```\n\n\n\u003e**NOTE**\n\u003e If your project uses authentication, then `app.UseWatchDog();` should come after app.UseRouting(), app.UseAuthentication(), app.UseAuthorization(), in that order\n\u003c!--- \u003eIf your projects startup or program class contains app.UseMvc() or app.UseRouting() then app.UseWatchDog() should come after `Important`\n\u003eIf your projects startup or program class contains app.UseEndpoints() then app.UseWatchDog() should come before `Important` --\u003e\n\n# ![Request and Response Sample Details](https://github.com/IzyPro/WatchDog/blob/main/requestLog.png)\n\n#### Optional Configurations: `Optional`\n- Blacklist: List of routes, paths or endpoints to be ignored (should be a comma separated string like below).\n- Serializer: If not default, specify the type of global json serializer/converter used.\n- CorsPolicy: Policy Name if project uses CORS.\n- UseOutputCache: If your application uses [ASP.NET Output Cache](https://learn.microsoft.com/en-us/aspnet/core/performance/caching/output). This feature is only available for .NET8 and above.\n- UseRegexForBlacklisting: Enables the use of Regex to blacklist request routes, paths or endpoints.\n\n```c#\napp.UseWatchDog(opt =\u003e \n{ \n   opt.WatchPageUsername = \"admin\"; \n   opt.WatchPagePassword = \"Qwerty@123\"; \n   //Optional\n   opt.Blacklist = \"Test/testPost, api/auth/login\"; //Prevent logging for specified endpoints\n   opt.Serializer = WatchDogSerializerEnum.Newtonsoft; //If your project use a global json converter\n   opt.CorsPolicy = \"MyCorsPolicy\";\n   opt.UseOutputCache = true;\n   opt.UseRegexForBlacklisting = true;\n });\n```\n\n#### Add WatchDog Exception Logger `Optional`\nThis is used to log in-app exceptions that occur during a particular HTTP request.\n# ![Exception Sample Details](https://github.com/IzyPro/WatchDog/blob/main/exceptionLog.png)\n\n\u003e**NOTE**\n\u003eAdd Exception Logger before the main WatchDog Middleware, preferably at the top of the middleware hierarchy so as to catch possible early exceptions.\n\n\n```c#\napp.UseWatchDogExceptionLogger();\n\n...\n\napp.UseWatchDog(opt =\u003e \n{ \n   opt.WatchPageUsername = \"admin\"; \n   opt.WatchPagePassword = \"Qwerty@123\"; \n   ...\n });\n```\n### Log Messages/Events\n```\nWatchLogger.Log(\"...Test Log...\");\nWatchLogger.LogWarning(JsonConvert.Serialize(model));\nWatchLogger.LogError(res.Content, eventId: reference);\n```\n\n# ![In-code log messages](https://github.com/IzyPro/WatchDog/blob/main/in-code.png)\n\n#### Sink Logs from ILogger\nYou can also sink logs from the .NET ILogger into WatchDog\n\nFor .NET 6 and above\n```\nbuilder.Logging.AddWatchDogLogger();\n```\nFor .NET Core 3.1, configure logging and add `.AddWatchDogLogger()` to the `CreateHostBuilder` method of the `Program.cs` class\n```\nHost.CreateDefaultBuilder(args)\n .ConfigureLogging( logging =\u003e\n {\n     logging.AddWatchDogLogger();\n })\n .ConfigureWebHostDefaults(webBuilder =\u003e\n {\n     webBuilder.UseStartup\u003cStartup\u003e();\n });\n```\n\n### View Logs and Exception\nStart your server and head to `/watchdog` to view the logs.\n\u003eExample: https://myserver.com/watchdog or https://localhost:[your-port]/watchdog\n\nStill confused? Check out the implementation in the [WatchDogCompleteTestAPI](https://github.com/IzyPro/WatchDog/tree/main/WatchDogCompleteTestAPI) folder or the .NET 6 implementation in the [WatchDogCompleteApiNet6](https://github.com/IzyPro/WatchDog/tree/main/WatchDogCompleteApiNet6) folder.\n\n## Contribution\nFeel like something is missing? Fork the repo and send a PR.\n\nEncountered a bug? Fork the repo and send a PR.\n\nAlternatively, open an issue and we'll get to it as soon as we can.\n\n## Credit\nKelechi Onyekwere -  [Github](https://github.com/Khelechy) [Twitter](https://twitter.com/khelechy1337)\n\nIsrael Ulelu - [Github](https://github.com/IzyPro) [Twitter](https://twitter.com/IzyPro_)\n\n\n\u003c!--\n### [Official Documentation](https://watchdog-3.gitbook.io/watchdog)\n","funding_links":[],"categories":["C\\#","Game-BenchMark/Metric/Tool","C#"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FIzyPro%2FWatchDog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FIzyPro%2FWatchDog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FIzyPro%2FWatchDog/lists"}