From 818af9d4827ea66358abbc3929d20e09861c7306 Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Sun, 22 Feb 2009 01:26:18 +0000 Subject: Refactor log4net logger handling in script engine. (#3148) --- OpenSim/ScriptEngine/Shared/RegionInfoStructure.cs | 1 - OpenSim/ScriptEngine/Shared/ScriptStructure.cs | 12 +++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'OpenSim/ScriptEngine/Shared') diff --git a/OpenSim/ScriptEngine/Shared/RegionInfoStructure.cs b/OpenSim/ScriptEngine/Shared/RegionInfoStructure.cs index 693f38c..64b33d4 100644 --- a/OpenSim/ScriptEngine/Shared/RegionInfoStructure.cs +++ b/OpenSim/ScriptEngine/Shared/RegionInfoStructure.cs @@ -48,7 +48,6 @@ namespace OpenSim.ScriptEngine.Shared public Dictionary Compilers; public Dictionary Schedulers; public Dictionary CommandProviders; - public ILog Logger; public void Executors_Execute(EventParams p) { diff --git a/OpenSim/ScriptEngine/Shared/ScriptStructure.cs b/OpenSim/ScriptEngine/Shared/ScriptStructure.cs index 785040c..1095a8b 100644 --- a/OpenSim/ScriptEngine/Shared/ScriptStructure.cs +++ b/OpenSim/ScriptEngine/Shared/ScriptStructure.cs @@ -29,6 +29,7 @@ using System; using System.Collections.Generic; using System.Reflection; using System.Text; +using log4net; using OpenMetaverse; using OpenSim.Region.ScriptEngine.Interfaces; using OpenSim.Region.ScriptEngine.Shared.ScriptBase; @@ -38,6 +39,8 @@ namespace OpenSim.ScriptEngine.Shared { public struct ScriptStructure { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + public RegionInfoStructure RegionInfo; public ScriptMetaData ScriptMetaData; @@ -91,8 +94,7 @@ namespace OpenSim.ScriptEngine.Shared if (!InternalFunctions.ContainsKey(FunctionName)) { // TODO: Send message in-world - //RegionInfo.Scene. - RegionInfo.Logger.ErrorFormat("[{0}] Script function \"{1}\" was not found.", Name, FunctionName); + m_log.ErrorFormat("[{0}] Script function \"{1}\" was not found.", Name, FunctionName); return; } @@ -103,7 +105,7 @@ namespace OpenSim.ScriptEngine.Shared } catch (Exception e) { - RegionInfo.Logger.ErrorFormat("[{0}] Execute \"{1}\" failed: {2}", Name, FunctionName, e.ToString()); + m_log.ErrorFormat("[{0}] Execute \"{1}\" failed: {2}", Name, FunctionName, e.ToString()); } } } @@ -126,8 +128,8 @@ namespace OpenSim.ScriptEngine.Shared if (!InternalFunctions.ContainsKey(mi.Name)) InternalFunctions.Add(mi.Name, Delegate.CreateDelegate(scriptObjectType, ScriptObject, mi)); else - RegionInfo.Logger.ErrorFormat("[{0}] Error: Script function \"{1}\" is already added. We do not support overloading.", - Name, mi.Name); + m_log.ErrorFormat("[{0}] Error: Script function \"{1}\" is already added. We do not support overloading.", + Name, mi.Name); } } } -- cgit v1.1