From 30f92279138bc4f533a8b3a41e5a2dc8ad2f1774 Mon Sep 17 00:00:00 2001 From: high Date: Mon, 20 Jun 2011 17:22:39 -0400 Subject: [PATCH] fixed log caller --- TShockAPI/Log.cs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/TShockAPI/Log.cs b/TShockAPI/Log.cs index 8263356b..7dcf6129 100644 --- a/TShockAPI/Log.cs +++ b/TShockAPI/Log.cs @@ -117,16 +117,14 @@ namespace TShockAPI return; } - StackTrace trace = new StackTrace(); - StackFrame frame = null; + string caller = "TShock"; - frame = trace.GetFrame(2); - - string caller = "TShock: "; - - if (frame != null && frame.GetMethod().DeclaringType != null) + StackFrame frame = new StackTrace().GetFrame(2); + if (frame != null) { - caller += frame.GetMethod().DeclaringType.Name + ": "; + var meth = frame.GetMethod(); + if (meth != null) + caller = meth.DeclaringType.Name; } _logWriter.WriteLine(string.Format("{0} - {1}: {2}: {3}",