I've refactored the code to make it more readable, maintainable.
Changes:
Renamed theMessageFormat constant to MessageFormatString to make its purpose clearer.
Introduced an explaining variable timeStamp for the DateTime.UtcNow.ToString(CultureInfo.InvariantCulture) to make the code more readable.
The WriteLogMessages() method was extracted from the InitializeLogFileWriterBackgroundTaskAsync() method to separate the responsibility of continuously writing the log messages from the initialization process. By doing so, the code is more readable, maintainable, and adheres to the Single Responsibility Principle.
Code refactoring for LoggingService.cs
PR Type
What kind of change does this PR introduce?
other: Code refactoring for LoggingService.cs
Other information
I've refactored the code to make it more readable, maintainable.
Changes:
MessageFormat
constant toMessageFormatString
to make its purpose clearer.timeStamp
for theDateTime.UtcNow.ToString(CultureInfo.InvariantCulture)
to make the code more readable.WriteLogMessages()
method was extracted from theInitializeLogFileWriterBackgroundTaskAsync()
method to separate the responsibility of continuously writing the log messages from the initialization process. By doing so, the code is more readable, maintainable, and adheres to the Single Responsibility Principle.