diff options
Converted logging to use log4net.
Changed LogBase to ConsoleBase, which handles console I/O.
This is mostly an in-place conversion, so lots of refactoring can still be done.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs index f09e631..78d9f7d 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs | |||
@@ -26,7 +26,6 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | |||
30 | using System; | 29 | using System; |
31 | using System.IO; | 30 | using System.IO; |
32 | using Nini.Config; | 31 | using Nini.Config; |
@@ -45,6 +44,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
45 | [Serializable] | 44 | [Serializable] |
46 | public abstract class ScriptEngine : IRegionModule, OpenSim.Region.ScriptEngine.Common.ScriptServerInterfaces.ScriptEngine, iScriptEngineFunctionModule | 45 | public abstract class ScriptEngine : IRegionModule, OpenSim.Region.ScriptEngine.Common.ScriptServerInterfaces.ScriptEngine, iScriptEngineFunctionModule |
47 | { | 46 | { |
47 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | ||
48 | |||
48 | public Scene World; | 49 | public Scene World; |
49 | public EventManager m_EventManager; // Handles and queues incoming events from OpenSim | 50 | public EventManager m_EventManager; // Handles and queues incoming events from OpenSim |
50 | public EventQueueManager m_EventQueueManager; // Executes events, handles script threads | 51 | public EventQueueManager m_EventQueueManager; // Executes events, handles script threads |
@@ -73,7 +74,10 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
73 | 74 | ||
74 | public abstract ScriptManager _GetScriptManager(); | 75 | public abstract ScriptManager _GetScriptManager(); |
75 | 76 | ||
76 | private LogBase m_log; | 77 | public log4net.ILog Log |
78 | { | ||
79 | get { return m_log; } | ||
80 | } | ||
77 | 81 | ||
78 | public ScriptEngine() | 82 | public ScriptEngine() |
79 | { | 83 | { |
@@ -81,25 +85,18 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
81 | Common.mySE = this; | 85 | Common.mySE = this; |
82 | } | 86 | } |
83 | 87 | ||
84 | public LogBase Log | 88 | public void InitializeEngine(Scene Sceneworld, IConfigSource config, bool HookUpToServer, ScriptManager newScriptManager) |
85 | { | ||
86 | get { return m_log; } | ||
87 | } | ||
88 | |||
89 | public void InitializeEngine(Scene Sceneworld, IConfigSource config, LogBase logger, bool HookUpToServer, ScriptManager newScriptManager) | ||
90 | { | 89 | { |
91 | World = Sceneworld; | 90 | World = Sceneworld; |
92 | m_log = logger; | ||
93 | ConfigSource = config; | 91 | ConfigSource = config; |
94 | Log.Verbose(ScriptEngineName, "ScriptEngine initializing"); | 92 | m_log.Info("[" + ScriptEngineName + "]: ScriptEngine initializing"); |
95 | 93 | ||
96 | // Make sure we have config | 94 | // Make sure we have config |
97 | if (ConfigSource.Configs[ScriptEngineName] == null) | 95 | if (ConfigSource.Configs[ScriptEngineName] == null) |
98 | ConfigSource.AddConfig(ScriptEngineName); | 96 | ConfigSource.AddConfig(ScriptEngineName); |
99 | ScriptConfigSource = ConfigSource.Configs[ScriptEngineName]; | 97 | ScriptConfigSource = ConfigSource.Configs[ScriptEngineName]; |
100 | 98 | ||
101 | 99 | //m_log.Info("[" + ScriptEngineName + "]: InitializeEngine"); | |
102 | //m_logger.Status(ScriptEngineName, "InitializeEngine"); | ||
103 | 100 | ||
104 | // Create all objects we'll be using | 101 | // Create all objects we'll be using |
105 | m_EventQueueManager = new EventQueueManager(this); | 102 | m_EventQueueManager = new EventQueueManager(this); |
@@ -111,11 +108,9 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
111 | m_ASYNCLSLCommandManager = new AsyncLSLCommandManager(this); | 108 | m_ASYNCLSLCommandManager = new AsyncLSLCommandManager(this); |
112 | m_MaintenanceThread = new MaintenanceThread(this); | 109 | m_MaintenanceThread = new MaintenanceThread(this); |
113 | 110 | ||
114 | Log.Verbose(ScriptEngineName, "Reading configuration from config section \"" + ScriptEngineName + "\""); | 111 | m_log.Info("[" + ScriptEngineName + "]: Reading configuration from config section \"" + ScriptEngineName + "\""); |
115 | ReadConfig(); | 112 | ReadConfig(); |
116 | 113 | ||
117 | |||
118 | |||
119 | // Should we iterate the region for scripts that needs starting? | 114 | // Should we iterate the region for scripts that needs starting? |
120 | // Or can we assume we are loaded before anything else so we can use proper events? | 115 | // Or can we assume we are loaded before anything else so we can use proper events? |
121 | } | 116 | } |
@@ -129,10 +124,11 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
129 | { | 124 | { |
130 | return this.m_EventManager; | 125 | return this.m_EventManager; |
131 | } | 126 | } |
127 | |||
132 | public void ReadConfig() | 128 | public void ReadConfig() |
133 | { | 129 | { |
134 | //#if DEBUG | 130 | //#if DEBUG |
135 | // Log.Debug(ScriptEngineName, "Refreshing configuration for all modules"); | 131 | // m_log.Debug("[" + ScriptEngineName + "]: Refreshing configuration for all modules"); |
136 | //#endif | 132 | //#endif |
137 | RefreshConfigFileSeconds = ScriptConfigSource.GetInt("RefreshConfig", 30); | 133 | RefreshConfigFileSeconds = ScriptConfigSource.GetInt("RefreshConfig", 30); |
138 | 134 | ||
@@ -153,10 +149,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
153 | if (m_AppDomainManager != null) m_AppDomainManager.ReadConfig(); | 149 | if (m_AppDomainManager != null) m_AppDomainManager.ReadConfig(); |
154 | if (m_ASYNCLSLCommandManager != null) m_ASYNCLSLCommandManager.ReadConfig(); | 150 | if (m_ASYNCLSLCommandManager != null) m_ASYNCLSLCommandManager.ReadConfig(); |
155 | if (m_MaintenanceThread != null) m_MaintenanceThread.ReadConfig(); | 151 | if (m_MaintenanceThread != null) m_MaintenanceThread.ReadConfig(); |
156 | |||
157 | } | 152 | } |
158 | 153 | ||
159 | |||
160 | #region IRegionModule | 154 | #region IRegionModule |
161 | 155 | ||
162 | public abstract void Initialise(Scene scene, IConfigSource config); | 156 | public abstract void Initialise(Scene scene, IConfigSource config); |
@@ -179,8 +173,6 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
179 | get { return false; } | 173 | get { return false; } |
180 | } | 174 | } |
181 | 175 | ||
182 | |||
183 | |||
184 | #endregion | 176 | #endregion |
185 | 177 | ||
186 | /// <summary> | 178 | /// <summary> |
@@ -194,4 +186,4 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
194 | private bool _PleaseShutdown = false; | 186 | private bool _PleaseShutdown = false; |
195 | 187 | ||
196 | } | 188 | } |
197 | } \ No newline at end of file | 189 | } |