You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Moving logging to defined methods in DiagnosticEventsTableStorageRepository. Disabling service when the client is not authorized to use the table storage service.
LoggerMessage.Define(LogLevel.Warning,newEventId(1,nameof(ServiceDisabledFailedToCreateClient)),"An error occurred initializing the Table Storage Client. We are unable to record diagnostic events, so the diagnostic logging service is being stopped.");
LoggerMessage.Define(LogLevel.Warning,newEventId(2,nameof(ServiceDisabledUnauthorizedClient)),"The Table Storage Client is not authorized to access the table storage account. We are unable to record diagnostic events, so the diagnostic logging service is being stopped.");
LoggerMessage.Define<string>(LogLevel.Debug,newEventId(3,nameof(PurgingDiagnosticEvents)),"Purging diagnostic events with versions older than '{currentEventVersion}'.");
LoggerMessage.Define<string>(LogLevel.Debug,newEventId(4,nameof(DeletingTableWithoutEventVersion)),"Deleting table '{tableName}' as it contains records without an EventVersion.");
LoggerMessage.Define<string>(LogLevel.Debug,newEventId(5,nameof(DeletingTableWithOutdatedEventVersion)),"Deleting table '{tableName}' as it contains records with an outdated EventVersion.");
LoggerMessage.Define(LogLevel.Error,newEventId(6,nameof(ErrorPurgingDiagnosticEventVersions)),"Error occurred when attempting to purge previous diagnostic event versions.");
LoggerMessage.Define(LogLevel.Error,newEventId(8,nameof(UnableToGetTableReferenceOrCreateTable)),"Unable to get table reference or create table. Aborting write operation.");
LoggerMessage.Define(LogLevel.Debug,newEventId(10,nameof(PrimaryHostStateProviderNotAvailable)),"PrimaryHostStateProvider is not available. Skipping the check for primary host.");
_logger.LogWarning("An error occurred initializing the Table Storage Client. We are unable to record diagnostic events, so the diagnostic logging service is being stopped.");
// TableClient is initialized lazily and it will stop the timer that schedules flush logs whenever it fails to initialize.
171
201
// We need to check if the TableClient is null before proceeding. This helps when the first time the property is accessed is as part of the FlushLogs method.
172
202
// We should not have any events stored pending to be written since WriteDiagnosticEvent will check for an initialized TableClient.
Assert.Equal(messages[0].FormattedMessage,"An error occurred initializing the Table Storage Client. We are unable to record diagnostic events, so the diagnostic logging service is being stopped.");
167
+
varerrorIntializingPresent=messages.Any(m =>m.FormattedMessage.Contains("An error occurred initializing the Table Storage Client. We are unable to record diagnostic events, so the diagnostic logging service is being stopped."));
0 commit comments