Inline variables.
This commit is contained in:
committed by
Gustas
parent
949ef1662d
commit
147804ac30
@@ -24,25 +24,25 @@ namespace OpenRA
|
||||
Log.AddChannel("exception", exceptionName);
|
||||
|
||||
if (Game.EngineVersion != null)
|
||||
Log.Write("exception", "OpenRA engine version {0}", Game.EngineVersion);
|
||||
Log.Write("exception", $"OpenRA engine version {Game.EngineVersion}");
|
||||
|
||||
if (Game.ModData != null)
|
||||
{
|
||||
var mod = Game.ModData.Manifest.Metadata;
|
||||
Log.Write("exception", "{0} mod version {1}", mod.Title, mod.Version);
|
||||
Log.Write("exception", $"{mod.Title} mod version ${mod.Version}");
|
||||
}
|
||||
|
||||
if (Game.OrderManager != null && Game.OrderManager.World != null && Game.OrderManager.World.Map != null)
|
||||
{
|
||||
var map = Game.OrderManager.World.Map;
|
||||
Log.Write("exception", "on map {0} ({1} by {2}).", map.Uid, map.Title, map.Author);
|
||||
Log.Write("exception", $"on map {map.Uid} ({map.Title} by {map.Author}).");
|
||||
}
|
||||
|
||||
Log.Write("exception", "Date: {0:u}", DateTime.UtcNow);
|
||||
Log.Write("exception", "Operating System: {0} ({1})", Platform.CurrentPlatform, Environment.OSVersion);
|
||||
Log.Write("exception", "Runtime Version: {0}", Platform.RuntimeVersion);
|
||||
Log.Write("exception", $"Date: {DateTime.UtcNow:u}");
|
||||
Log.Write("exception", $"Operating System: {Platform.CurrentPlatform} ({Environment.OSVersion})");
|
||||
Log.Write("exception", $"Runtime Version: {Platform.RuntimeVersion}", Platform.RuntimeVersion);
|
||||
var rpt = BuildExceptionReport(ex).ToString();
|
||||
Log.Write("exception", "{0}", rpt);
|
||||
Log.Write("exception", rpt);
|
||||
Console.Error.WriteLine(rpt);
|
||||
}
|
||||
|
||||
@@ -61,11 +61,11 @@ namespace OpenRA
|
||||
if (ex == null)
|
||||
return sb;
|
||||
|
||||
sb.AppendIndentedFormatLine(indent, "Exception of type `{0}`: {1}", ex.GetType().FullName, ex.Message);
|
||||
sb.AppendIndentedFormatLine(indent, $"Exception of type `{ex.GetType().FullName}`: {ex.Message}");
|
||||
|
||||
if (ex is TypeLoadException tle)
|
||||
{
|
||||
sb.AppendIndentedFormatLine(indent, "TypeName=`{0}`", tle.TypeName);
|
||||
sb.AppendIndentedFormatLine(indent, $"TypeName=`{tle.TypeName}`");
|
||||
}
|
||||
else if (ex is OutOfMemoryException)
|
||||
{
|
||||
@@ -73,14 +73,14 @@ namespace OpenRA
|
||||
GC.Collect();
|
||||
GC.WaitForPendingFinalizers();
|
||||
GC.Collect();
|
||||
sb.AppendIndentedFormatLine(indent, "GC Memory (post-collect)={0:N0}", GC.GetTotalMemory(false));
|
||||
sb.AppendIndentedFormatLine(indent, "GC Memory (pre-collect)={0:N0}", gcMemoryBeforeCollect);
|
||||
sb.AppendIndentedFormatLine(indent, $"GC Memory (post-collect)={GC.GetTotalMemory(false):N0}");
|
||||
sb.AppendIndentedFormatLine(indent, $"GC Memory (pre-collect)={gcMemoryBeforeCollect:N0}");
|
||||
|
||||
using (var p = Process.GetCurrentProcess())
|
||||
{
|
||||
sb.AppendIndentedFormatLine(indent, "Working Set={0:N0}", p.WorkingSet64);
|
||||
sb.AppendIndentedFormatLine(indent, "Private Memory={0:N0}", p.PrivateMemorySize64);
|
||||
sb.AppendIndentedFormatLine(indent, "Virtual Memory={0:N0}", p.VirtualMemorySize64);
|
||||
sb.AppendIndentedFormatLine(indent, $"Working Set={p.WorkingSet64:N0}");
|
||||
sb.AppendIndentedFormatLine(indent, $"Private Memory={p.PrivateMemorySize64:N0}");
|
||||
sb.AppendIndentedFormatLine(indent, $"Virtual Memory={p.VirtualMemorySize64:N0}");
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -94,7 +94,7 @@ namespace OpenRA
|
||||
BuildExceptionReport(ex.InnerException, sb, indent + 1);
|
||||
}
|
||||
|
||||
sb.AppendIndentedFormatLine(indent, "{0}", ex.StackTrace);
|
||||
sb.AppendIndentedFormatLine(indent, ex.StackTrace);
|
||||
|
||||
return sb;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user