mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-16 08:25:28 +00:00
Use C# 10 string interpolation wherever possible
This commit is contained in:
@@ -176,7 +176,7 @@ public sealed class ArchiLogger {
|
||||
}
|
||||
|
||||
// Otherwise, we ran into fatal exception before logging module could even get initialized, so activate fallback logging that involves file and console
|
||||
string message = string.Format(CultureInfo.CurrentCulture, DateTime.Now + " " + Strings.ErrorEarlyFatalExceptionInfo, SharedInfo.Version) + Environment.NewLine;
|
||||
string message = $"{DateTime.Now} {string.Format(CultureInfo.CurrentCulture, Strings.ErrorEarlyFatalExceptionInfo, SharedInfo.Version)}{Environment.NewLine}";
|
||||
|
||||
try {
|
||||
await File.WriteAllTextAsync(SharedInfo.LogFile, message).ConfigureAwait(false);
|
||||
@@ -191,7 +191,7 @@ public sealed class ArchiLogger {
|
||||
}
|
||||
|
||||
while (true) {
|
||||
message = string.Format(CultureInfo.CurrentCulture, Strings.ErrorEarlyFatalExceptionPrint, previousMethodName, exception.Message, exception.StackTrace) + Environment.NewLine;
|
||||
message = $"{string.Format(CultureInfo.CurrentCulture, Strings.ErrorEarlyFatalExceptionPrint, previousMethodName, exception.Message, exception.StackTrace)}{Environment.NewLine}";
|
||||
|
||||
try {
|
||||
await File.AppendAllTextAsync(SharedInfo.LogFile, message).ConfigureAwait(false);
|
||||
|
||||
@@ -44,7 +44,7 @@ internal static class Logging {
|
||||
internal const string NLogConfigurationFile = "NLog.config";
|
||||
|
||||
private const byte ConsoleResponsivenessDelay = 250; // In milliseconds
|
||||
private const string GeneralLayout = @"${date:format=yyyy-MM-dd HH\:mm\:ss}|${processname}-${processid}|${level:uppercase=true}|" + LayoutMessage;
|
||||
private const string GeneralLayout = $@"${{date:format=yyyy-MM-dd HH\:mm\:ss}}|${{processname}}-${{processid}}|${{level:uppercase=true}}|{LayoutMessage}";
|
||||
private const string LayoutMessage = @"${logger}|${message}${onexception:inner= ${exception:format=toString,Data}}";
|
||||
|
||||
private static readonly ConcurrentHashSet<LoggingRule> ConsoleLoggingRules = new();
|
||||
|
||||
Reference in New Issue
Block a user