Deprecate string format log shorthand.

This commit is contained in:
Matthias Mailänder
2023-05-04 17:44:46 +02:00
committed by abcdefg30
parent e251126dd4
commit 1c2ce0dcc0
27 changed files with 100 additions and 84 deletions

View File

@@ -128,7 +128,8 @@ namespace OpenRA.Network
}
catch (Exception e)
{
Log.Write("geoip", "DatabaseReader failed: {0}", e);
Log.Write("geoip", "DatabaseReader failed:");
Log.Write("geoip", e);
}
}
@@ -142,7 +143,8 @@ namespace OpenRA.Network
}
catch (Exception e)
{
Log.Write("geoip", "LookupCountry failed: {0}", e);
Log.Write("geoip", "LookupCountry failed:");
Log.Write("geoip", e);
}
}

View File

@@ -49,8 +49,8 @@ namespace OpenRA.Network
// Only interact with one at a time. Some support both UPnP and NAT-PMP.
natDevice = args.Device;
Log.Write("nat", "Device found: {0}", natDevice.DeviceEndpoint);
Log.Write("nat", "Type: {0}", natDevice.NatProtocol);
Log.Write("nat", $"Device found: {natDevice.DeviceEndpoint}");
Log.Write("nat", $"Type: {natDevice.NatProtocol}");
}
finally
{

View File

@@ -209,7 +209,7 @@ namespace OpenRA
default:
{
Log.Write("debug", "Received unknown order with type {0}", type);
Log.Write("debug", $"Received unknown order with type {type}");
return null;
}
}
@@ -217,7 +217,7 @@ namespace OpenRA
catch (Exception e)
{
Log.Write("debug", "Caught exception while processing order");
Log.Write("debug", e.ToString());
Log.Write("debug", e);
// HACK: this can hopefully go away in the future
TextNotificationsManager.Debug("Ignoring malformed order that would have crashed the game");

View File

@@ -119,12 +119,12 @@ namespace OpenRA.Network
{
desyncFrameFound = true;
var mod = Game.ModData.Manifest.Metadata;
Log.Write("sync", "Player: {0} ({1} {2} {3})", Game.Settings.Player.Name, Platform.CurrentPlatform, Environment.OSVersion, Platform.RuntimeVersion);
Log.Write("sync", $"Player: {Game.Settings.Player.Name} ({Platform.CurrentPlatform} {Environment.OSVersion} {Platform.RuntimeVersion})");
if (Game.IsHost)
Log.Write("sync", "Player is host.");
Log.Write("sync", "Game ID: {0} (Mod: {1} at Version {2})", orderManager.LobbyInfo.GlobalSettings.GameUid, mod.Title, mod.Version);
Log.Write("sync", "Sync for net frame {0} -------------", r.Frame);
Log.Write("sync", "SharedRandom: {0} (#{1})", r.SyncedRandom, r.TotalCount);
Log.Write("sync", $"Game ID: {orderManager.LobbyInfo.GlobalSettings.GameUid} (Mod: {mod.Title} at Version {mod.Version})");
Log.Write("sync", $"Sync for net frame {r.Frame} -------------");
Log.Write("sync", $"SharedRandom: {r.SyncedRandom} (#{r.TotalCount})");
Log.Write("sync", "Synced Traits:");
foreach (var a in r.Traits)
{
@@ -139,7 +139,7 @@ namespace OpenRA.Network
Log.Write("sync", "Synced Effects:");
foreach (var e in r.Effects)
{
Log.Write("sync", "\t {0} ({1})", e.Name, e.Hash);
Log.Write("sync", $"\t {e.Name} ({e.Hash})");
var nvp = e.NamesValues;
for (var i = 0; i < nvp.Names.Length; i++)
@@ -149,7 +149,7 @@ namespace OpenRA.Network
Log.Write("sync", "Orders Issued:");
foreach (var o in r.Orders)
Log.Write("sync", "\t {0}", o.ToString());
Log.Write("sync", $"\t {o}");
}
}