mirror of
https://github.com/opensim/opensim.git
synced 2026-08-10 03:06:05 +08:00
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.
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
*
|
||||
*/
|
||||
/* Original code: Tedd Hansen */
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.RemoteServer
|
||||
{
|
||||
public static class Common
|
||||
@@ -43,15 +44,15 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer
|
||||
public static void SendToDebug(string Message)
|
||||
{
|
||||
//if (Debug == true)
|
||||
mySE.Log.Verbose("ScriptEngine", "Debug: " + Message);
|
||||
mySE.Log.Info("[ScriptEngine]: Debug: " + Message);
|
||||
//SendToDebugEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message);
|
||||
}
|
||||
|
||||
public static void SendToLog(string Message)
|
||||
{
|
||||
//if (Debug == true)
|
||||
mySE.Log.Verbose("ScriptEngine", "LOG: " + Message);
|
||||
mySE.Log.Info("[ScriptEngine]: LOG: " + Message);
|
||||
//SendToLogEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
*
|
||||
*/
|
||||
/* Original code: Tedd Hansen */
|
||||
|
||||
using System;
|
||||
using libsecondlife;
|
||||
using OpenSim.Framework;
|
||||
@@ -40,7 +41,6 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer
|
||||
[Serializable]
|
||||
internal class EventManager
|
||||
{
|
||||
|
||||
System.Collections.Generic.Dictionary<uint, ScriptServerInterfaces.ServerRemotingObject> remoteScript = new System.Collections.Generic.Dictionary<uint, ScriptServerInterfaces.ServerRemotingObject>();
|
||||
TCPClient m_TCPClient;
|
||||
TRPC_Remote RPC;
|
||||
@@ -59,32 +59,28 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer
|
||||
RPC.ReceiveCommand += new TRPC_Remote.ReceiveCommandDelegate(RPC_ReceiveCommand);
|
||||
myScriptServerID = m_TCPClient.ConnectAndReturnID(remoteHost, remotePort);
|
||||
|
||||
myScriptEngine.Log.Verbose("RemoteEngine", "Hooking up to server events");
|
||||
myScriptEngine.Log.Info("[RemoteEngine]: Hooking up to server events");
|
||||
//myScriptEngine.World.EventManager.OnObjectGrab += touch_start;
|
||||
myScriptEngine.World.EventManager.OnRezScript += OnRezScript;
|
||||
//myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript;
|
||||
|
||||
|
||||
}
|
||||
|
||||
void RPC_ReceiveCommand(int ID, string Command, params object[] p)
|
||||
{
|
||||
myScriptEngine.Log.Notice("REMOTESERVER", "Received command: '" + Command + "'");
|
||||
myScriptEngine.Log.Info("[REMOTESERVER]: Received command: '" + Command + "'");
|
||||
if (p != null)
|
||||
{
|
||||
for (int i = 0; i < p.Length; i++)
|
||||
{
|
||||
myScriptEngine.Log.Notice("REMOTESERVER", "Param " + i + ": " + p[i].ToString());
|
||||
myScriptEngine.Log.Info("[REMOTESERVER]: Param " + i + ": " + p[i].ToString());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void OnRezScript(uint localID, LLUUID itemID, string script)
|
||||
{
|
||||
// WE ARE CREATING A NEW SCRIPT ... CREATE SCRIPT, GET A REMOTEID THAT WE MAP FROM LOCALID
|
||||
myScriptEngine.Log.Verbose("RemoteEngine", "Creating new script (with connection)");
|
||||
myScriptEngine.Log.Info("[RemoteEngine]: Creating new script (with connection)");
|
||||
|
||||
// Temp for now: We have one connection only - this is hardcoded in myScriptServerID
|
||||
RPC.SendCommand(myScriptServerID, "OnRezScript", localID, itemID.ToString(), script);
|
||||
@@ -92,18 +88,15 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer
|
||||
//ScriptServerInterfaces.ServerRemotingObject obj = myScriptEngine.m_RemoteServer.Connect("localhost", 1234);
|
||||
//remoteScript.Add(localID, obj);
|
||||
//remoteScript[localID].Events().OnRezScript(localID, itemID, script);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void touch_start(uint localID, LLVector3 offsetPos, IClientAPI remoteClient)
|
||||
{
|
||||
//remoteScript[localID].Events.touch_start(localID, offsetPos, remoteClient);
|
||||
//remoteScript[localID].Events.touch_start(localID, offsetPos, remoteClient);
|
||||
RPC.SendCommand(myScriptServerID, "touch_start", offsetPos, "How to transfer IClientAPI?");
|
||||
}
|
||||
|
||||
|
||||
|
||||
// PLACEHOLDERS -- CODE WILL CHANGE!
|
||||
|
||||
|
||||
@@ -266,6 +259,5 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer
|
||||
//{
|
||||
// remoteScript[localID].Events.http_response(localID, itemID);
|
||||
//}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
*
|
||||
*/
|
||||
/* Original code: Tedd Hansen */
|
||||
|
||||
using System;
|
||||
using Nini.Config;
|
||||
using OpenSim.Framework.Console;
|
||||
@@ -41,28 +42,27 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer
|
||||
[Serializable]
|
||||
public class ScriptEngine : IRegionModule
|
||||
{
|
||||
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
internal Scene World;
|
||||
internal EventManager m_EventManager; // Handles and queues incoming events from OpenSim
|
||||
internal RemoteServer m_RemoteServer; // Handles connections to remote servers
|
||||
|
||||
private LogBase m_log;
|
||||
|
||||
public ScriptEngine()
|
||||
{
|
||||
Common.mySE = this;
|
||||
}
|
||||
|
||||
public LogBase Log
|
||||
public log4net.ILog Log
|
||||
{
|
||||
get { return m_log; }
|
||||
}
|
||||
|
||||
public void InitializeEngine(Scene Sceneworld, LogBase logger)
|
||||
public void InitializeEngine(Scene Sceneworld)
|
||||
{
|
||||
World = Sceneworld;
|
||||
m_log = logger;
|
||||
|
||||
Log.Verbose("ScriptEngine", "RemoteEngine (Remote Script Server) initializing");
|
||||
m_log.Info("[ScriptEngine]: RemoteEngine (Remote Script Server) initializing");
|
||||
// Create all objects we'll be using
|
||||
m_EventManager = new EventManager(this);
|
||||
m_RemoteServer = new RemoteServer();
|
||||
@@ -74,12 +74,11 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer
|
||||
// We are shutting down
|
||||
}
|
||||
|
||||
|
||||
#region IRegionModule
|
||||
|
||||
public void Initialise(Scene scene, IConfigSource config)
|
||||
{
|
||||
InitializeEngine(scene, MainLog.Instance);
|
||||
InitializeEngine(scene);
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
@@ -101,6 +100,5 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user