0x7c13 / Notepads

A modern, lightweight text editor with a minimalist design.
https://www.NotepadsApp.com
MIT License
8.65k stars 474 forks source link

other: Code refactoring for LoggingService.cs #1217

Closed aayushpandya closed 1 year ago

aayushpandya commented 1 year ago

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:

  1. Renamed theMessageFormat constant to MessageFormatString to make its purpose clearer.
  2. Introduced an explaining variable timeStamp for the DateTime.UtcNow.ToString(CultureInfo.InvariantCulture) to make the code more readable.
  3. 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.