From 91689847fdb75c68b2e92f2991876f1b1b0dc269 Mon Sep 17 00:00:00 2001 From: VahidN Date: Sun, 31 Mar 2024 10:17:57 +0330 Subject: [PATCH] Improve `DisableLogging` docs --- README.md | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9087a19..7329998 100644 --- a/README.md +++ b/README.md @@ -587,7 +587,38 @@ And then change the log level to `Debug` in your `appsettings.json` file: } ``` -Or ... you can use the second optional parameter of the `DisableLogging` method to access the published events of this library more easily. +Or ... you can use the second optional parameter of the `DisableLogging` method to access the published events of this library more easily: + + +```c# + .DisableLogging(disable: !environment.IsDevelopment(), cacheableEvent: args => + { + switch (args.EventId) + { + case CacheableLogEventId.CacheHit: + break; + case CacheableLogEventId.QueryResultCached: + break; + case CacheableLogEventId.QueryResultInvalidated: + break; + case CacheableLogEventId.CachingSkipped: + break; + case CacheableLogEventId.InvalidationSkipped: + break; + case CacheableLogEventId.CachingSystemStarted: + break; + case CacheableLogEventId.CachingError: + break; + case CacheableLogEventId.QueryResultSuppressed: + break; + case CacheableLogEventId.CacheDependenciesCalculated: + break; + case CacheableLogEventId.CachePolicyCalculated: + break; + } + Console.WriteLine($"{args.EventId} -> {args.Message}"); + }) +``` Now after running a query multiple times, you should have these logged lines: