Hello,
i want to trace what my app is doing.
so i made a short debug logger
Code (CSharp):
static public void prinstantiate(params string[] mytuf) {
if (!tmpflowlog) return;
System.Diagnostics.StackTrace stackTrace = new System.Diagnostics.StackTrace(); // get call stack
System.Diagnostics.StackFrame[] stackFrames = stackTrace.GetFrames(); // get method calls (frames)
// write call stack method names
string display="";
foreach (string mtuf in mytuf) {
display += mtuf;
}
string text= "
Instantiate: " + display + " Count: “+ profiler +” on " + g.stopWatch.Elapsed+"
“;
foreach (System.Diagnostics.StackFrame stackFrame in stackFrames) {
text+= " " + stackFrame.GetMethod ().Name+ " L” +stackFrame.GetFileLineNumber() + " : ";
}
File.AppendAllText (Path.Combine (p.logpath, “instantiate.txt”), text);
//Debug.Log (text);
profiler++;
}
but i cannot get the lines with it prints something like:
Instantiate: infoinput Count: 1825 on 00:00:10.4046821
prinstantiate L0 : getobjbn L0 : .cctor L0 : hover L0 : hover L0 : hover L0 : Update L0 :
Question 1:
How can i get the linenumber?
Question2:
Why does it return 0?