Configurations

Features and Optional Configurations

AddWatchDogServices() Optional Configurations

  • IsAutoClear: Clears logs after a specific duration (Default = Weekly).

  • ClearTimeSchedule: Duration for logs to clear automatically.

  • SetExternalDbConnString: Specifies connection string for an external database.

  • DbDriverOption: Database type for the connection string (Options = MSSQL, MySQL, Postgres, Mongo).

services.AddWatchDogServices(opt => 
{ 
   opt.IsAutoClear = true;
   opt.ClearTimeSchedule = WatchDogAutoClearScheduleEnum.Monthly;
   opt.SetExternalDbConnString = "Server=localhost;Database=testDb;User Id=postgres;Password=root;"; 
   opt.DbDriverOption = WatchDogSqlDriverEnum.PostgreSql; 
});

UseWatchDog() Optional Configurations

  • Blacklist: List of routes, paths or endpoints to be ignored (should be a comma separated string like below).

  • Serializer: If not default, specify the type of global json serializer/converter used

  • CorsPolicy: Policy Name if project uses CORS

app.UseWatchDog(opt => 
{ 
   opt.WatchPageUsername = "admin"; 
   opt.WatchPagePassword = "Qwerty@123"; 
   //Optional
   opt.Blacklist = "Test/testPost, api/auth/login"; //Prevent logging for specified endpoints
   opt.Serializer = WatchDogSerializerEnum.Newtonsoft; //If your project use a global json converter
   opt.CorsPolicy = "MyCorsPolicy"
 });

Last updated

Was this helpful?