Added caller method to the log.

This commit is contained in:
Deathmax 2011-06-20 17:53:50 +08:00
parent 4ae62f53a7
commit d79412912d

View file

@ -117,7 +117,17 @@ namespace TShockAPI
return;
}
string caller = "TShock";
StackTrace trace = new StackTrace();
StackFrame frame = null;
frame = trace.GetFrame(2);
string caller = "TShock: ";
if (frame != null && frame.GetMethod().DeclaringType != null)
{
caller += frame.GetMethod().DeclaringType.Name + ": ";
}
_logWriter.WriteLine(string.Format("{0} - {1}: {2}: {3}",
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture),