diff options
author | Jeff Ames | 2008-02-05 19:44:27 +0000 |
---|---|---|
committer | Jeff Ames | 2008-02-05 19:44:27 +0000 |
commit | 6ed5283bc06a62f38eb517e67b975832b603bf61 (patch) | |
tree | e5f635018789b73a99ddeca0883a68368fa5eece /OpenSim/Region/ScriptEngine/RemoteServer | |
parent | Cut down on the number of packets sent during terraforming. Terraforming shou... (diff) | |
download | opensim-SC_OLD-6ed5283bc06a62f38eb517e67b975832b603bf61.zip opensim-SC_OLD-6ed5283bc06a62f38eb517e67b975832b603bf61.tar.gz opensim-SC_OLD-6ed5283bc06a62f38eb517e67b975832b603bf61.tar.bz2 opensim-SC_OLD-6ed5283bc06a62f38eb517e67b975832b603bf61.tar.xz |
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 '')
-rw-r--r-- | OpenSim/Region/ScriptEngine/RemoteServer/Common.cs | 7 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/RemoteServer/EventManager.cs | 22 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/RemoteServer/ScriptEngine.cs | 18 |
3 files changed, 19 insertions, 28 deletions
diff --git a/OpenSim/Region/ScriptEngine/RemoteServer/Common.cs b/OpenSim/Region/ScriptEngine/RemoteServer/Common.cs index bac32cb..e65b8ff 100644 --- a/OpenSim/Region/ScriptEngine/RemoteServer/Common.cs +++ b/OpenSim/Region/ScriptEngine/RemoteServer/Common.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | /* Original code: Tedd Hansen */ | 28 | /* Original code: Tedd Hansen */ |
29 | |||
29 | namespace OpenSim.Region.ScriptEngine.RemoteServer | 30 | namespace OpenSim.Region.ScriptEngine.RemoteServer |
30 | { | 31 | { |
31 | public static class Common | 32 | public static class Common |
@@ -43,15 +44,15 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer | |||
43 | public static void SendToDebug(string Message) | 44 | public static void SendToDebug(string Message) |
44 | { | 45 | { |
45 | //if (Debug == true) | 46 | //if (Debug == true) |
46 | mySE.Log.Verbose("ScriptEngine", "Debug: " + Message); | 47 | mySE.Log.Info("[ScriptEngine]: Debug: " + Message); |
47 | //SendToDebugEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); | 48 | //SendToDebugEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); |
48 | } | 49 | } |
49 | 50 | ||
50 | public static void SendToLog(string Message) | 51 | public static void SendToLog(string Message) |
51 | { | 52 | { |
52 | //if (Debug == true) | 53 | //if (Debug == true) |
53 | mySE.Log.Verbose("ScriptEngine", "LOG: " + Message); | 54 | mySE.Log.Info("[ScriptEngine]: LOG: " + Message); |
54 | //SendToLogEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); | 55 | //SendToLogEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); |
55 | } | 56 | } |
56 | } | 57 | } |
57 | } \ No newline at end of file | 58 | } |
diff --git a/OpenSim/Region/ScriptEngine/RemoteServer/EventManager.cs b/OpenSim/Region/ScriptEngine/RemoteServer/EventManager.cs index 047ff2e..971982c 100644 --- a/OpenSim/Region/ScriptEngine/RemoteServer/EventManager.cs +++ b/OpenSim/Region/ScriptEngine/RemoteServer/EventManager.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | /* Original code: Tedd Hansen */ | 28 | /* Original code: Tedd Hansen */ |
29 | |||
29 | using System; | 30 | using System; |
30 | using libsecondlife; | 31 | using libsecondlife; |
31 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
@@ -40,7 +41,6 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer | |||
40 | [Serializable] | 41 | [Serializable] |
41 | internal class EventManager | 42 | internal class EventManager |
42 | { | 43 | { |
43 | |||
44 | System.Collections.Generic.Dictionary<uint, ScriptServerInterfaces.ServerRemotingObject> remoteScript = new System.Collections.Generic.Dictionary<uint, ScriptServerInterfaces.ServerRemotingObject>(); | 44 | System.Collections.Generic.Dictionary<uint, ScriptServerInterfaces.ServerRemotingObject> remoteScript = new System.Collections.Generic.Dictionary<uint, ScriptServerInterfaces.ServerRemotingObject>(); |
45 | TCPClient m_TCPClient; | 45 | TCPClient m_TCPClient; |
46 | TRPC_Remote RPC; | 46 | TRPC_Remote RPC; |
@@ -59,32 +59,28 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer | |||
59 | RPC.ReceiveCommand += new TRPC_Remote.ReceiveCommandDelegate(RPC_ReceiveCommand); | 59 | RPC.ReceiveCommand += new TRPC_Remote.ReceiveCommandDelegate(RPC_ReceiveCommand); |
60 | myScriptServerID = m_TCPClient.ConnectAndReturnID(remoteHost, remotePort); | 60 | myScriptServerID = m_TCPClient.ConnectAndReturnID(remoteHost, remotePort); |
61 | 61 | ||
62 | myScriptEngine.Log.Verbose("RemoteEngine", "Hooking up to server events"); | 62 | myScriptEngine.Log.Info("[RemoteEngine]: Hooking up to server events"); |
63 | //myScriptEngine.World.EventManager.OnObjectGrab += touch_start; | 63 | //myScriptEngine.World.EventManager.OnObjectGrab += touch_start; |
64 | myScriptEngine.World.EventManager.OnRezScript += OnRezScript; | 64 | myScriptEngine.World.EventManager.OnRezScript += OnRezScript; |
65 | //myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript; | 65 | //myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript; |
66 | |||
67 | |||
68 | } | 66 | } |
69 | 67 | ||
70 | void RPC_ReceiveCommand(int ID, string Command, params object[] p) | 68 | void RPC_ReceiveCommand(int ID, string Command, params object[] p) |
71 | { | 69 | { |
72 | myScriptEngine.Log.Notice("REMOTESERVER", "Received command: '" + Command + "'"); | 70 | myScriptEngine.Log.Info("[REMOTESERVER]: Received command: '" + Command + "'"); |
73 | if (p != null) | 71 | if (p != null) |
74 | { | 72 | { |
75 | for (int i = 0; i < p.Length; i++) | 73 | for (int i = 0; i < p.Length; i++) |
76 | { | 74 | { |
77 | myScriptEngine.Log.Notice("REMOTESERVER", "Param " + i + ": " + p[i].ToString()); | 75 | myScriptEngine.Log.Info("[REMOTESERVER]: Param " + i + ": " + p[i].ToString()); |
78 | } | 76 | } |
79 | } | 77 | } |
80 | |||
81 | } | 78 | } |
82 | 79 | ||
83 | |||
84 | public void OnRezScript(uint localID, LLUUID itemID, string script) | 80 | public void OnRezScript(uint localID, LLUUID itemID, string script) |
85 | { | 81 | { |
86 | // WE ARE CREATING A NEW SCRIPT ... CREATE SCRIPT, GET A REMOTEID THAT WE MAP FROM LOCALID | 82 | // WE ARE CREATING A NEW SCRIPT ... CREATE SCRIPT, GET A REMOTEID THAT WE MAP FROM LOCALID |
87 | myScriptEngine.Log.Verbose("RemoteEngine", "Creating new script (with connection)"); | 83 | myScriptEngine.Log.Info("[RemoteEngine]: Creating new script (with connection)"); |
88 | 84 | ||
89 | // Temp for now: We have one connection only - this is hardcoded in myScriptServerID | 85 | // Temp for now: We have one connection only - this is hardcoded in myScriptServerID |
90 | RPC.SendCommand(myScriptServerID, "OnRezScript", localID, itemID.ToString(), script); | 86 | RPC.SendCommand(myScriptServerID, "OnRezScript", localID, itemID.ToString(), script); |
@@ -92,18 +88,15 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer | |||
92 | //ScriptServerInterfaces.ServerRemotingObject obj = myScriptEngine.m_RemoteServer.Connect("localhost", 1234); | 88 | //ScriptServerInterfaces.ServerRemotingObject obj = myScriptEngine.m_RemoteServer.Connect("localhost", 1234); |
93 | //remoteScript.Add(localID, obj); | 89 | //remoteScript.Add(localID, obj); |
94 | //remoteScript[localID].Events().OnRezScript(localID, itemID, script); | 90 | //remoteScript[localID].Events().OnRezScript(localID, itemID, script); |
95 | |||
96 | |||
97 | } | 91 | } |
98 | 92 | ||
99 | public void touch_start(uint localID, LLVector3 offsetPos, IClientAPI remoteClient) | 93 | public void touch_start(uint localID, LLVector3 offsetPos, IClientAPI remoteClient) |
100 | { | 94 | { |
101 | //remoteScript[localID].Events.touch_start(localID, offsetPos, remoteClient); | 95 | //remoteScript[localID].Events.touch_start(localID, offsetPos, remoteClient); |
102 | RPC.SendCommand(myScriptServerID, "touch_start", offsetPos, "How to transfer IClientAPI?"); | 96 | RPC.SendCommand(myScriptServerID, "touch_start", offsetPos, "How to transfer IClientAPI?"); |
103 | } | 97 | } |
104 | 98 | ||
105 | 99 | ||
106 | |||
107 | // PLACEHOLDERS -- CODE WILL CHANGE! | 100 | // PLACEHOLDERS -- CODE WILL CHANGE! |
108 | 101 | ||
109 | 102 | ||
@@ -266,6 +259,5 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer | |||
266 | //{ | 259 | //{ |
267 | // remoteScript[localID].Events.http_response(localID, itemID); | 260 | // remoteScript[localID].Events.http_response(localID, itemID); |
268 | //} | 261 | //} |
269 | |||
270 | } | 262 | } |
271 | } \ No newline at end of file | 263 | } |
diff --git a/OpenSim/Region/ScriptEngine/RemoteServer/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/RemoteServer/ScriptEngine.cs index d0dc7ab..8d27251 100644 --- a/OpenSim/Region/ScriptEngine/RemoteServer/ScriptEngine.cs +++ b/OpenSim/Region/ScriptEngine/RemoteServer/ScriptEngine.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | /* Original code: Tedd Hansen */ | 28 | /* Original code: Tedd Hansen */ |
29 | |||
29 | using System; | 30 | using System; |
30 | using Nini.Config; | 31 | using Nini.Config; |
31 | using OpenSim.Framework.Console; | 32 | using OpenSim.Framework.Console; |
@@ -41,28 +42,27 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer | |||
41 | [Serializable] | 42 | [Serializable] |
42 | public class ScriptEngine : IRegionModule | 43 | public class ScriptEngine : IRegionModule |
43 | { | 44 | { |
45 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | ||
46 | |||
44 | internal Scene World; | 47 | internal Scene World; |
45 | internal EventManager m_EventManager; // Handles and queues incoming events from OpenSim | 48 | internal EventManager m_EventManager; // Handles and queues incoming events from OpenSim |
46 | internal RemoteServer m_RemoteServer; // Handles connections to remote servers | 49 | internal RemoteServer m_RemoteServer; // Handles connections to remote servers |
47 | 50 | ||
48 | private LogBase m_log; | ||
49 | |||
50 | public ScriptEngine() | 51 | public ScriptEngine() |
51 | { | 52 | { |
52 | Common.mySE = this; | 53 | Common.mySE = this; |
53 | } | 54 | } |
54 | 55 | ||
55 | public LogBase Log | 56 | public log4net.ILog Log |
56 | { | 57 | { |
57 | get { return m_log; } | 58 | get { return m_log; } |
58 | } | 59 | } |
59 | 60 | ||
60 | public void InitializeEngine(Scene Sceneworld, LogBase logger) | 61 | public void InitializeEngine(Scene Sceneworld) |
61 | { | 62 | { |
62 | World = Sceneworld; | 63 | World = Sceneworld; |
63 | m_log = logger; | ||
64 | 64 | ||
65 | Log.Verbose("ScriptEngine", "RemoteEngine (Remote Script Server) initializing"); | 65 | m_log.Info("[ScriptEngine]: RemoteEngine (Remote Script Server) initializing"); |
66 | // Create all objects we'll be using | 66 | // Create all objects we'll be using |
67 | m_EventManager = new EventManager(this); | 67 | m_EventManager = new EventManager(this); |
68 | m_RemoteServer = new RemoteServer(); | 68 | m_RemoteServer = new RemoteServer(); |
@@ -74,12 +74,11 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer | |||
74 | // We are shutting down | 74 | // We are shutting down |
75 | } | 75 | } |
76 | 76 | ||
77 | |||
78 | #region IRegionModule | 77 | #region IRegionModule |
79 | 78 | ||
80 | public void Initialise(Scene scene, IConfigSource config) | 79 | public void Initialise(Scene scene, IConfigSource config) |
81 | { | 80 | { |
82 | InitializeEngine(scene, MainLog.Instance); | 81 | InitializeEngine(scene); |
83 | } | 82 | } |
84 | 83 | ||
85 | public void PostInitialise() | 84 | public void PostInitialise() |
@@ -101,6 +100,5 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer | |||
101 | } | 100 | } |
102 | 101 | ||
103 | #endregion | 102 | #endregion |
104 | |||
105 | } | 103 | } |
106 | } \ No newline at end of file | 104 | } |