diff --git a/OpenRA.Game/CryptoUtil.cs b/OpenRA.Game/CryptoUtil.cs index c666eae74f..96b81829af 100644 --- a/OpenRA.Game/CryptoUtil.cs +++ b/OpenRA.Game/CryptoUtil.cs @@ -187,8 +187,10 @@ namespace OpenRA } catch (Exception e) { - Log.Write("debug", "Failed to decrypt string with exception: {0}", e); - Console.WriteLine("String decryption failed: {0}", e); + Log.Write("debug", "Failed to decrypt string with exception:"); + Log.Write("debug", e); + Console.WriteLine("String decryption failed:"); + Console.WriteLine(e); return null; } } @@ -211,8 +213,10 @@ namespace OpenRA } catch (Exception e) { - Log.Write("debug", "Failed to sign string with exception: {0}", e); - Console.WriteLine("String signing failed: {0}", e); + Log.Write("debug", "Failed to sign string with exception"); + Log.Write("debug", e); + Console.WriteLine("String signing failed:"); + Console.WriteLine(e); return null; } } @@ -235,8 +239,10 @@ namespace OpenRA } catch (Exception e) { - Log.Write("debug", "Failed to verify signature with exception: {0}", e); - Console.WriteLine("Signature validation failed: {0}", e); + Log.Write("debug", "Failed to verify signature with exception:"); + Log.Write("debug", e); + Console.WriteLine("Signature validation failed:"); + Console.WriteLine(e); return false; } } diff --git a/OpenRA.Game/ExternalMods.cs b/OpenRA.Game/ExternalMods.cs index 8ef0b13c36..f15eb4f609 100644 --- a/OpenRA.Game/ExternalMods.cs +++ b/OpenRA.Game/ExternalMods.cs @@ -81,8 +81,8 @@ namespace OpenRA } catch (Exception e) { - Log.Write("debug", "Failed to parse mod metadata file '{0}'", path); - Log.Write("debug", e.ToString()); + Log.Write("debug", $"Failed to parse mod metadata file '{path}'"); + Log.Write("debug", e); } } } @@ -174,7 +174,7 @@ namespace OpenRA catch (Exception e) { Log.Write("debug", "Failed to register current mod metadata"); - Log.Write("debug", e.ToString()); + Log.Write("debug", e); } } } @@ -213,8 +213,8 @@ namespace OpenRA } catch (Exception e) { - Log.Write("debug", "Failed to parse mod metadata file '{0}'", path); - Log.Write("debug", e.ToString()); + Log.Write("debug", $"Failed to parse mod metadata file '{path}'"); + Log.Write("debug", e); } // Remove from the ingame mod switcher @@ -225,12 +225,12 @@ namespace OpenRA try { File.Delete(path); - Log.Write("debug", "Removed invalid mod metadata file '{0}'", path); + Log.Write("debug", $"Removed invalid mod metadata file '{path}'"); } catch (Exception e) { - Log.Write("debug", "Failed to remove mod metadata file '{0}'", path); - Log.Write("debug", e.ToString()); + Log.Write("debug", $"Failed to remove mod metadata file '{path}'"); + Log.Write("debug", e); } } } @@ -251,8 +251,8 @@ namespace OpenRA } catch (Exception e) { - Log.Write("debug", "Failed to remove mod metadata file '{0}'", path); - Log.Write("debug", e.ToString()); + Log.Write("debug", $"Failed to remove mod metadata file '{path}'"); + Log.Write("debug", e); } } } diff --git a/OpenRA.Game/Graphics/ChromeProvider.cs b/OpenRA.Game/Graphics/ChromeProvider.cs index a4a132eb06..a9adf85f5f 100644 --- a/OpenRA.Game/Graphics/ChromeProvider.cs +++ b/OpenRA.Game/Graphics/ChromeProvider.cs @@ -263,13 +263,13 @@ namespace OpenRA.Graphics if (!collections.TryGetValue(collectionName, out var collection)) { - Log.Write("debug", "Could not find collection '{0}'", collectionName); + Log.Write("debug", $"Could not find collection '{collectionName}'"); return new Size(0, 0); } if (collection.PanelRegion == null || collection.PanelRegion.Length != 8) { - Log.Write("debug", "Collection '{0}' does not define a valid PanelRegion", collectionName); + Log.Write("debug", $"Collection '{collectionName}' does not define a valid PanelRegion"); return new Size(0, 0); } diff --git a/OpenRA.Game/LocalPlayerProfile.cs b/OpenRA.Game/LocalPlayerProfile.cs index 9d5616a824..f7a67655e0 100644 --- a/OpenRA.Game/LocalPlayerProfile.cs +++ b/OpenRA.Game/LocalPlayerProfile.cs @@ -66,8 +66,10 @@ namespace OpenRA } catch (Exception e) { - Console.WriteLine("Failed to load keys: {0}", e); - Log.Write("debug", "Failed to load player keypair from `{0}` with exception: {1}", filePath, e); + Console.WriteLine("Failed to load keys:"); + Console.WriteLine(e); + Log.Write("debug", $"Failed to load player keypair from `{filePath}` with exception:"); + Log.Write("debug", e); } } @@ -91,7 +93,7 @@ namespace OpenRA innerData = FieldLoader.Load(yaml.Value); if (innerData.KeyRevoked) { - Log.Write("debug", "Revoking key with fingerprint {0}", Fingerprint); + Log.Write("debug", $"Revoking key with fingerprint {Fingerprint}"); DeleteKeypair(); } else @@ -102,7 +104,8 @@ namespace OpenRA } catch (Exception e) { - Log.Write("debug", "Failed to parse player data result with exception: {0}", e); + Log.Write("debug", "Failed to parse player data result with exception:"); + Log.Write("debug", e); innerState = LinkState.ConnectionFailed; } finally @@ -136,8 +139,10 @@ namespace OpenRA } catch (Exception e) { - Log.Write("debug", "Failed to generate keypair with exception: {1}", e); - Console.WriteLine("Key generation failed: {0}", e); + Log.Write("debug", "Failed to generate keypair with exception:"); + Log.Write("debug", e); + Console.WriteLine("Key generation failed:"); + Console.WriteLine(e); innerState = LinkState.Uninitialized; } @@ -152,8 +157,10 @@ namespace OpenRA } catch (Exception e) { - Log.Write("debug", "Failed to delete keypair with exception: {1}", e); - Console.WriteLine("Key deletion failed: {0}", e); + Log.Write("debug", "Failed to delete keypair with exception:"); + Log.Write("debug", e); + Console.WriteLine("Key deletion failed:"); + Console.WriteLine(e); } innerState = LinkState.Uninitialized; diff --git a/OpenRA.Game/Map/Map.cs b/OpenRA.Game/Map/Map.cs index abfaf965aa..dfe1b6ea1d 100644 --- a/OpenRA.Game/Map/Map.cs +++ b/OpenRA.Game/Map/Map.cs @@ -441,7 +441,8 @@ namespace OpenRA } catch (Exception e) { - Log.Write("debug", "Failed to load rules for {0} with error {1}", Title, e); + Log.Write("debug", $"Failed to load rules for {Title} with error"); + Log.Write("debug", e); InvalidCustomRules = true; InvalidCustomRulesException = e; Rules = Ruleset.LoadDefaultsForTileSet(modData, Tileset); @@ -1204,7 +1205,7 @@ namespace OpenRA // This shouldn't happen. But if it does, return the original value and hope the caller doesn't explode. if (unProjected.Count == 0) { - Log.Write("debug", "Failed to clamp map cell {0} to map bounds", uv); + Log.Write("debug", $"Failed to clamp map cell {uv} to map bounds"); return uv; } } @@ -1276,7 +1277,7 @@ namespace OpenRA // This shouldn't happen. But if it does, return the original value and hope the caller doesn't explode. if (unProjected.Count == 0) { - Log.Write("debug", "Failed to find closest edge for map cell {0}", uv); + Log.Write("debug", $"Failed to find closest edge for map cell {uv}"); return uv; } } diff --git a/OpenRA.Game/Map/MapCache.cs b/OpenRA.Game/Map/MapCache.cs index 5e854f9373..b70207ba27 100644 --- a/OpenRA.Game/Map/MapCache.cs +++ b/OpenRA.Game/Map/MapCache.cs @@ -158,10 +158,12 @@ namespace OpenRA catch (Exception e) { mapPackage?.Dispose(); - Console.WriteLine("Failed to load map: {0}", map); - Console.WriteLine("Details: {0}", e); - Log.Write("debug", "Failed to load map: {0}", map); - Log.Write("debug", "Details: {0}", e); + Console.WriteLine($"Failed to load map: {map}"); + Console.WriteLine("Details:"); + Console.WriteLine(e); + Log.Write("debug", $"Failed to load map: {map}"); + Log.Write("debug", "Details:"); + Log.Write("debug", e); } } @@ -253,8 +255,9 @@ namespace OpenRA } catch (Exception e) { - Log.Write("debug", "Remote map query failed with error: {0}", e); - Log.Write("debug", "URL was: {0}", url); + Log.Write("debug", "Remote map query failed with error:"); + Log.Write("debug", e); + Log.Write("debug", $"URL was: {url}"); foreach (var uid in batchUids) { @@ -315,7 +318,8 @@ namespace OpenRA } catch (Exception e) { - Log.Write("debug", "Failed to load minimap with exception: {0}", e); + Log.Write("debug", "Failed to load minimap with exception:"); + Log.Write("debug", e); } }); } diff --git a/OpenRA.Game/Network/GeoIP.cs b/OpenRA.Game/Network/GeoIP.cs index 60beb6f53c..cb1b4f1c70 100644 --- a/OpenRA.Game/Network/GeoIP.cs +++ b/OpenRA.Game/Network/GeoIP.cs @@ -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); } } diff --git a/OpenRA.Game/Network/Nat.cs b/OpenRA.Game/Network/Nat.cs index 8358b05cc3..8d008a74a6 100644 --- a/OpenRA.Game/Network/Nat.cs +++ b/OpenRA.Game/Network/Nat.cs @@ -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 { diff --git a/OpenRA.Game/Network/Order.cs b/OpenRA.Game/Network/Order.cs index bfb0033687..ef683cbf18 100644 --- a/OpenRA.Game/Network/Order.cs +++ b/OpenRA.Game/Network/Order.cs @@ -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"); diff --git a/OpenRA.Game/Network/SyncReport.cs b/OpenRA.Game/Network/SyncReport.cs index 4f0520fdcb..bc18936c8c 100644 --- a/OpenRA.Game/Network/SyncReport.cs +++ b/OpenRA.Game/Network/SyncReport.cs @@ -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}"); } } diff --git a/OpenRA.Game/Player.cs b/OpenRA.Game/Player.cs index 6bf1bb8fb6..35f910524b 100644 --- a/OpenRA.Game/Player.cs +++ b/OpenRA.Game/Player.cs @@ -216,7 +216,7 @@ namespace OpenRA { var logic = PlayerActor.TraitsImplementing().FirstOrDefault(b => b.Info.Type == BotType); if (logic == null) - Log.Write("debug", "Invalid bot type: {0}", BotType); + Log.Write("debug", $"Invalid bot type: {BotType}"); else logic.Activate(this); } diff --git a/OpenRA.Game/Scripting/ScriptContext.cs b/OpenRA.Game/Scripting/ScriptContext.cs index 37b47821b1..e91bcc79c6 100644 --- a/OpenRA.Game/Scripting/ScriptContext.cs +++ b/OpenRA.Game/Scripting/ScriptContext.cs @@ -219,10 +219,10 @@ namespace OpenRA.Scripting public void FatalError(string message) { var stacktrace = new StackTrace().ToString(); - Console.WriteLine("Fatal Lua Error: {0}", message); + Console.WriteLine($"Fatal Lua Error: {message}"); Console.WriteLine(stacktrace); - Log.Write("lua", "Fatal Lua Error: {0}", message); + Log.Write("lua", $"Fatal Lua Error: {message}"); Log.Write("lua", stacktrace); FatalErrorOccurred = true; diff --git a/OpenRA.Game/Server/MapStatusCache.cs b/OpenRA.Game/Server/MapStatusCache.cs index ea93cc492e..e92e0897d5 100644 --- a/OpenRA.Game/Server/MapStatusCache.cs +++ b/OpenRA.Game/Server/MapStatusCache.cs @@ -39,7 +39,7 @@ namespace OpenRA.Server void OnLintFailure(string message) { - Log.Write("server", "Map {0} failed lint with error: {1}", map.Title, message); + Log.Write("server", $"Map {map.Title} failed lint with error: {message}"); failed = true; } @@ -84,13 +84,13 @@ namespace OpenRA.Server } catch (Exception e) { - Log.Write("server", "Failed to load rules for `{0}` with error :{1}", map.Title, e.Message); + Log.Write("server", $"Failed to load rules for `{map.Title}` with error: {e.Message}"); status = Session.MapStatus.Incompatible; } if (map.Players.Players.Count > MapPlayers.MaximumPlayerCount) { - Log.Write("server", "Failed to load `{0}`: Player count exceeds maximum ({1}/{2}).", map.Title, map.Players.Players.Count, MapPlayers.MaximumPlayerCount); + Log.Write("server", $"Failed to load `{map.Title}`: Player count exceeds maximum ({map.Players.Players.Count}/{MapPlayers.MaximumPlayerCount})."); status = Session.MapStatus.Incompatible; } diff --git a/OpenRA.Game/Sound/Sound.cs b/OpenRA.Game/Sound/Sound.cs index 53a0ff52d1..2d050840ad 100644 --- a/OpenRA.Game/Sound/Sound.cs +++ b/OpenRA.Game/Sound/Sound.cs @@ -60,7 +60,7 @@ namespace OpenRA { if (!fileSystem.Exists(filename)) { - Log.Write("sound", "LoadSound, file does not exist: {0}", filename); + Log.Write("sound", $"LoadSound, file does not exist: {filename}"); return default; } diff --git a/OpenRA.Game/Support/ExceptionHandler.cs b/OpenRA.Game/Support/ExceptionHandler.cs index c4813f02d8..f030e2790b 100644 --- a/OpenRA.Game/Support/ExceptionHandler.cs +++ b/OpenRA.Game/Support/ExceptionHandler.cs @@ -43,7 +43,7 @@ namespace OpenRA Log.Write("exception", $"Date: {DateTime.UtcNow:u}"); Log.Write("exception", $"Operating System: {Platform.CurrentPlatform} ({Platform.CurrentArchitecture}, {Environment.OSVersion})"); - Log.Write("exception", $"Runtime Version: {Platform.RuntimeVersion}", Platform.RuntimeVersion); + Log.Write("exception", $"Runtime Version: {Platform.RuntimeVersion}"); Log.Write("exception", $"Installed Language: {CultureInfo.InstalledUICulture.TwoLetterISOLanguageName} (Installed) {CultureInfo.CurrentCulture.TwoLetterISOLanguageName} (Current) {CultureInfo.CurrentUICulture.TwoLetterISOLanguageName} (Current UI)"); var rpt = BuildExceptionReport(ex).ToString(); diff --git a/OpenRA.Game/Support/LaunchArguments.cs b/OpenRA.Game/Support/LaunchArguments.cs index 3ab576175a..19d01935af 100644 --- a/OpenRA.Game/Support/LaunchArguments.cs +++ b/OpenRA.Game/Support/LaunchArguments.cs @@ -60,7 +60,7 @@ namespace OpenRA } catch (Exception ex) { - Log.Write("client", "Failed to parse Launch.URI or Launch.Connect: {0}", ex.Message); + Log.Write("client", $"Failed to parse Launch.URI or Launch.Connect: {ex.Message}"); return null; } } diff --git a/OpenRA.Game/Support/Log.cs b/OpenRA.Game/Support/Log.cs index 3e99807e5c..ee592721f5 100644 --- a/OpenRA.Game/Support/Log.cs +++ b/OpenRA.Game/Support/Log.cs @@ -176,11 +176,6 @@ namespace OpenRA ChannelWriter.TryWrite(new ChannelData(channelName, $"{e.Message}{Environment.NewLine}{e.StackTrace}")); } - public static void Write(string channelName, string format, params object[] args) - { - ChannelWriter.TryWrite(new ChannelData(channelName, format.F(args))); - } - public static void Dispose() { CancellationToken.Cancel(); diff --git a/OpenRA.Game/Support/PerfTimer.cs b/OpenRA.Game/Support/PerfTimer.cs index 29351370fa..6c9f0d6ea4 100644 --- a/OpenRA.Game/Support/PerfTimer.cs +++ b/OpenRA.Game/Support/PerfTimer.cs @@ -67,10 +67,10 @@ namespace OpenRA.Support Log.Write("perf", GetHeader(Indentation, name)); foreach (var child in children) child.Write(); - Log.Write("perf", FormatString, ElapsedMs, GetFooter(Indentation)); + Log.Write("perf", string.Format(FormatString, ElapsedMs, GetFooter(Indentation))); } else if (ElapsedMs >= thresholdMs) - Log.Write("perf", FormatString, ElapsedMs, Indentation + name); + Log.Write("perf", string.Format(FormatString, ElapsedMs, Indentation + name)); } float ElapsedMs => 1000f * ticks / Stopwatch.Frequency; @@ -79,9 +79,9 @@ namespace OpenRA.Support { var type = item.GetType(); var label = type == typeof(string) || type.IsGenericType ? item.ToString() : type.Name; - Log.Write("perf", FormatString, + Log.Write("perf", string.Format(FormatString, 1000f * (endStopwatchTicks - startStopwatchTicks) / Stopwatch.Frequency, - "[" + Game.LocalTick + "] " + name + ": " + label); + "[" + Game.LocalTick + "] " + name + ": " + label)); } public static long LongTickThresholdInStopwatchTicks => (long)(Stopwatch.Frequency * Game.Settings.Debug.LongTickThresholdMs / 1000f); diff --git a/OpenRA.Game/TraitDictionary.cs b/OpenRA.Game/TraitDictionary.cs index 137e615bb5..afcb74a539 100644 --- a/OpenRA.Game/TraitDictionary.cs +++ b/OpenRA.Game/TraitDictionary.cs @@ -60,7 +60,7 @@ namespace OpenRA { Log.AddChannel("traitreport", "traitreport.log"); foreach (var t in traits.OrderByDescending(t => t.Value.Queries).TakeWhile(t => t.Value.Queries > 0)) - Log.Write("traitreport", "{0}: {1}", t.Key.Name, t.Value.Queries); + Log.Write("traitreport", $"{t.Key.Name}: {t.Value.Queries}"); } public void AddTrait(Actor actor, object val) diff --git a/OpenRA.Mods.Common/Scripting/Properties/CombatProperties.cs b/OpenRA.Mods.Common/Scripting/Properties/CombatProperties.cs index 226765209d..397290c49f 100644 --- a/OpenRA.Mods.Common/Scripting/Properties/CombatProperties.cs +++ b/OpenRA.Mods.Common/Scripting/Properties/CombatProperties.cs @@ -91,10 +91,10 @@ namespace OpenRA.Mods.Common.Scripting { var target = Target.FromActor(targetActor); if (!target.IsValidFor(Self)) - Log.Write("lua", "{1} is an invalid target for {0}!", Self, targetActor); + Log.Write("lua", $"{targetActor} is an invalid target for {Self}!"); if (!targetActor.Info.HasTraitInfo() && !targetActor.CanBeViewedByPlayer(Self.Owner)) - Log.Write("lua", "{1} is not revealed for player {0}!", Self.Owner, targetActor); + Log.Write("lua", $"{targetActor} is not revealed for player {Self.Owner}!"); foreach (var attack in attackBases) attack.AttackTarget(target, AttackSource.Default, true, allowMove, forceAttack); diff --git a/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs b/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs index d9535b0ac6..9c9ab1ff00 100644 --- a/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs +++ b/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs @@ -968,7 +968,7 @@ namespace OpenRA.Mods.Common.Server if (!Exts.TryParseIntegerInvariant(parts[1], out var team)) { - Log.Write("server", "Invalid team: {0}", s); + Log.Write("server", $"Invalid team: {s}"); return false; } @@ -996,7 +996,7 @@ namespace OpenRA.Mods.Common.Server if (!Exts.TryParseIntegerInvariant(parts[1], out var handicap)) { - Log.Write("server", "Invalid handicap: {0}", s); + Log.Write("server", $"Invalid handicap: {s}"); return false; } @@ -1004,7 +1004,7 @@ namespace OpenRA.Mods.Common.Server var options = Enumerable.Range(0, 20).Select(i => 5 * i); if (!options.Contains(handicap)) { - Log.Write("server", "Invalid handicap: {0}", s); + Log.Write("server", $"Invalid handicap: {s}"); return false; } diff --git a/OpenRA.Mods.Common/Traits/World/ValidateOrder.cs b/OpenRA.Mods.Common/Traits/World/ValidateOrder.cs index 343b0eba27..bb1757f240 100644 --- a/OpenRA.Mods.Common/Traits/World/ValidateOrder.cs +++ b/OpenRA.Mods.Common/Traits/World/ValidateOrder.cs @@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Traits if (subjectClient == null) { - Log.Write("debug", "Tick {0}: Order sent to {1}: resolved ClientIndex `{2}` doesn't exist", world.WorldTick, order.Subject.Owner.PlayerName, subjectClientId); + Log.Write("debug", $"Tick {world.WorldTick}: Order sent to {order.Subject.Owner.PlayerName}: resolved ClientIndex `{subjectClientId}` doesn't exist"); return false; } diff --git a/OpenRA.Mods.Common/Widgets/Logic/Editor/ActorSelectorLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Editor/ActorSelectorLogic.cs index 4d5d290638..b2db0a1c78 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Editor/ActorSelectorLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Editor/ActorSelectorLogic.cs @@ -222,8 +222,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic } catch { - Log.Write("debug", "Map editor ignoring actor {0}, because of missing sprites for tileset {1}.", - actor.Name, World.Map.Rules.TerrainInfo.Id); + Log.Write("debug", $"Map editor ignoring actor {actor.Name}, " + + $"because of missing sprites for tileset {World.Map.Rules.TerrainInfo.Id}."); continue; } } diff --git a/OpenRA.Platforms.Default/DefaultPlatform.cs b/OpenRA.Platforms.Default/DefaultPlatform.cs index 265e35383a..13264a2eac 100644 --- a/OpenRA.Platforms.Default/DefaultPlatform.cs +++ b/OpenRA.Platforms.Default/DefaultPlatform.cs @@ -29,7 +29,8 @@ namespace OpenRA.Platforms.Default } catch (InvalidOperationException e) { - Log.Write("sound", "Failed to initialize OpenAL device. Error was {0}", e); + Log.Write("sound", "Failed to initialize OpenAL device. Error was"); + Log.Write("sound", e); return new DummySoundEngine(); } } diff --git a/OpenRA.Platforms.Default/OpenAlSoundEngine.cs b/OpenRA.Platforms.Default/OpenAlSoundEngine.cs index 4d6332dab8..9232d48812 100644 --- a/OpenRA.Platforms.Default/OpenAlSoundEngine.cs +++ b/OpenRA.Platforms.Default/OpenAlSoundEngine.cs @@ -65,7 +65,7 @@ namespace OpenRA.Platforms.Default var devicesPtr = ALC10.alcGetString(IntPtr.Zero, type); if (devicesPtr == IntPtr.Zero || AL10.alGetError() != AL10.AL_NO_ERROR) { - Log.Write("sound", "Failed to query OpenAL device list using {0}", label); + Log.Write("sound", $"Failed to query OpenAL device list using {label}"); return Array.Empty(); } @@ -140,7 +140,7 @@ namespace OpenRA.Platforms.Default AL10.alGenSources(1, out var source); if (AL10.alGetError() != AL10.AL_NO_ERROR) { - Log.Write("sound", "Failed generating OpenAL source {0}", i); + Log.Write("sound", $"Failed generating OpenAL source {i}"); return; } diff --git a/OpenRA.Platforms.Default/OpenGL.cs b/OpenRA.Platforms.Default/OpenGL.cs index b30c5bf017..62d3c2c2c3 100644 --- a/OpenRA.Platforms.Default/OpenGL.cs +++ b/OpenRA.Platforms.Default/OpenGL.cs @@ -716,7 +716,7 @@ namespace OpenRA.Platforms.Default Log.Write("graphics", ""); Log.Write("graphics", "OpenGL Information:"); var vendor = glGetString(GL_VENDOR); - Log.Write("graphics", "Vendor: {0}", vendor); + Log.Write("graphics", $"Vendor: {vendor}"); if (vendor.Contains("Microsoft")) { var msg = ""; @@ -725,9 +725,9 @@ namespace OpenRA.Platforms.Default Log.Write("graphics", msg); } - Log.Write("graphics", "Renderer: {0}", glGetString(GL_RENDERER)); - Log.Write("graphics", "GL Version: {0}", glGetString(GL_VERSION)); - Log.Write("graphics", "Shader Version: {0}", glGetString(GL_SHADING_LANGUAGE_VERSION)); + Log.Write("graphics", $"Renderer: {glGetString(GL_RENDERER)}"); + Log.Write("graphics", $"GL Version: {glGetString(GL_VERSION)}"); + Log.Write("graphics", $"Shader Version: {glGetString(GL_SHADING_LANGUAGE_VERSION)}"); Log.Write("graphics", "Available extensions:"); if (Profile != GLProfile.Legacy) diff --git a/OpenRA.Platforms.Default/Shader.cs b/OpenRA.Platforms.Default/Shader.cs index 2e58dc4b5f..5280198d20 100644 --- a/OpenRA.Platforms.Default/Shader.cs +++ b/OpenRA.Platforms.Default/Shader.cs @@ -59,7 +59,7 @@ namespace OpenRA.Platforms.Default var log = new StringBuilder(len); OpenGL.glGetShaderInfoLog(shader, len, out _, log); - Log.Write("graphics", "GL Info Log:\n{0}", log.ToString()); + Log.Write("graphics", $"GL Info Log:\n{log}"); throw new InvalidProgramException($"Compile error in shader object '{filename}'"); } @@ -105,7 +105,7 @@ namespace OpenRA.Platforms.Default var log = new StringBuilder(len); OpenGL.glGetProgramInfoLog(program, len, out _, log); - Log.Write("graphics", "GL Info Log:\n{0}", log.ToString()); + Log.Write("graphics", $"GL Info Log:\n{log}"); throw new InvalidProgramException($"Link error in shader program '{name}'"); }