-
Notifications
You must be signed in to change notification settings - Fork 4
Client Logging
patriciamazere edited this page Sep 29, 2020
·
4 revisions
Different information is logged in Application Insights.
An instrumentation key will need to be provided in the application configuration file (if the instrumentation key is not provided logging is disabled).
web.config
<add key="Moggles.ApplicationInsightsInstrumentationKey" value="myInstrumentationKey"/>
appsettings.json
"Moggles": {
"ApplicationInsightsInstrumentationKey": "myInstrumentationKey"
}
| Exceptions logged | Events logged |
|---|---|
| The API call that retrieves the Feature Toggles fails | When the cache entries are successfully refreshed |
| When the Feature Toggles are not available (both cache entries are empty) | When a force cache refresh event was handled |
| When detecting the deployed Feature Toggles and one of the assemblies it searches in could not be loaded |
If Application Insights is not an available option or you want to log to another location:
- Provide an implementation for IMogglesLoggingService
public class CustomLoggingService : IMogglesLoggingService
{
public void TrackEvent(string eventName, string application, string environment)
{
throw new NotImplementedException();
}
public void TrackException(Exception ex, string application, string environment)
{
throw new NotImplementedException();
}
public void TrackException(Exception ex, string customMessage, string application, string environment)
{
throw new NotImplementedException();
}
}
- Call overload of ConfigureAndStartClient:
Moggles.ConfigureAndStartClient(loggingService: new CustomLoggingService());