Bring over a part of logger refactoring from
MODIFY
WalletWasabi/Logging/Logger.cs
WalletWasabi/Logging/Logger.cs
@@ -127,21 +127,27 @@ namespace WalletWasabi.Logging
var messageBuilder = new StringBuilder();
messageBuilder.Append($"{DateTime.UtcNow.ToLocalTime():yyyy-MM-dd HH:mm:ss} {level.ToString().ToUpperInvariant()}");
- if (message != "" && category != "") // If none of them empty.
+ if (message == "")
{
- messageBuilder.Append($" {category}: {message}{EntrySeparator}");
+ if (category == "") // If both empty. It probably never happens though.
+ {
+ messageBuilder.Append($"{EntrySeparator}");
}
- else if (message == "" && category != "") // If only the message is empty.
+ else // If only the message is empty.
{
messageBuilder.Append($" {category}{EntrySeparator}");
}
- else if (message != "" && category == "") // If only the category is empty.
+ }
+ else
+ {
+ if (category == "") // If only the category is empty.
{
messageBuilder.Append($": {message}{EntrySeparator}");
}
- else // if (message == "" && category == "") // If both empty. It probably never happens though.
+ else // If none of them empty.
{
- messageBuilder.Append($"{EntrySeparator}");
+ messageBuilder.Append($" {category}: {message}{EntrySeparator}");
+ }
}
var finalMessage = messageBuilder.ToString();

Bring over a part of logger refactoring from 0559a2cf7fc6f9d7474e2eb38832560a088fca9a