Browse Source

Tweaked debug info code

pull/11/head
Anairkoen Schno 5 years ago
parent
commit
80688a2d1f
1 changed files with 11 additions and 9 deletions
  1. +11
    -9
      IPA.Loader/Logging/StandardLogger.cs

+ 11
- 9
IPA.Loader/Logging/StandardLogger.cs View File

@ -208,19 +208,21 @@ namespace IPA.Logging
{ {
// add source to message // add source to message
var stackFrame = new StackTrace(true).GetFrame(1); var stackFrame = new StackTrace(true).GetFrame(1);
var method = stackFrame.GetMethod();
var lineNo = stackFrame.GetFileLineNumber(); var lineNo = stackFrame.GetFileLineNumber();
var fileName = stackFrame.GetFileName();
var paramString = string.Join(", ", method.GetParameters().Select(p => p.ParameterType.FullName));
message = lineNo == 0 ? // no symbols
$"{{{method.DeclaringType?.FullName}::{method.Name}({paramString})}} {message}" :
$"{{{fileName}:{lineNo}}} {message}";
if (lineNo == 0)
{ // no debug info
var method = stackFrame.GetMethod();
var paramString = string.Join(", ", method.GetParameters().Select(p => p.ParameterType.FullName));
message = $"{{{method.DeclaringType?.FullName}::{method.Name}({paramString})}} {message}";
}
else
message = $"{{{stackFrame.GetFileName()}:{lineNo}}} {message}";
base.Debug(message);
} }
else
base.Debug(message);
base.Debug(message);
} }
private struct LogMessage private struct LogMessage


Loading…
Cancel
Save