From afaa12a9e2fd24c03c0f46716e9758cc591703c2 Mon Sep 17 00:00:00 2001 From: Tedd Hansen Date: Tue, 14 Aug 2007 15:59:36 +0000 Subject: ScriptEngine: Some error handling, logs to logger --- OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs | 5 +- .../DotNetEngine/Compiler/LSL/LSL_BaseClass.cs | 6 +- .../LSL_BuiltIn_Commands_TestImplementation.cs | 387 --------------------- .../ScriptEngine/DotNetEngine/EventManager.cs | 7 +- .../ScriptEngine/DotNetEngine/EventQueueManager.cs | 12 +- .../ScriptEngine/DotNetEngine/ScriptEngine.cs | 12 +- .../ScriptEngine/DotNetEngine/ScriptManager.cs | 18 +- 7 files changed, 32 insertions(+), 415 deletions(-) delete mode 100644 OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands_TestImplementation.cs (limited to 'OpenSim/Region/ScriptEngine/DotNetEngine') diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs index 6df5b9f..49367f6 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs @@ -35,6 +35,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine public static class Common { static public bool Debug = true; + static public ScriptEngine mySE; //public delegate void SendToDebugEventDelegate(string Message); //public delegate void SendToLogEventDelegate(string Message); @@ -44,13 +45,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine static public void SendToDebug(string Message) { //if (Debug == true) - Console.WriteLine("SE:Debug: " + Message); + mySE.m_logger.Verbose("ScriptEngine", "Debug: " + Message); //SendToDebugEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); } static public void SendToLog(string Message) { //if (Debug == true) - Console.WriteLine("SE:LOG: " + Message); + mySE.m_logger.Verbose("ScriptEngine", "LOG: " + Message); //SendToLogEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); } } diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs index 5fa25fb..f9908e4 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs @@ -13,7 +13,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL public void Start(OpenSim.Region.Environment.Scenes.Scene _World, string FullScriptID) { World = _World; - Common.SendToLog("OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass.Start() called. FullScriptID: " + FullScriptID); + Console.WriteLine("ScriptEngine", "LSL_BaseClass.Start() called. FullScriptID: " + FullScriptID); return; } @@ -49,14 +49,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL public void llWhisper(int channelID, string text) { //Common.SendToDebug("INTERNAL FUNCTION llWhisper(" + channelID + ", \"" + text + "\");"); - Console.WriteLine("llWhisper Channel " + channelID + ", Text: \"" + text + "\""); + Console.WriteLine("ScriptEngine", "llWhisper Channel " + channelID + ", Text: \"" + text + "\""); } //public void llSay(UInt32 channelID, string text) public void llSay(int channelID, string text) { //TODO: DO SOMETHING USEFUL HERE //Common.SendToDebug("INTERNAL FUNCTION llSay(" + (UInt32)channelID + ", \"" + (string)text + "\");"); - Console.WriteLine("llSay Channel " + channelID + ", Text: \"" + text + "\""); + Console.WriteLine("ScriptEngine", "llSay Channel " + channelID + ", Text: \"" + text + "\""); //World.SimChat( } public void llShout(UInt16 channelID, string text) { return; } diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands_TestImplementation.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands_TestImplementation.cs deleted file mode 100644 index 3a87fa9..0000000 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands_TestImplementation.cs +++ /dev/null @@ -1,387 +0,0 @@ - /* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -/* Original code: Tedd Hansen */ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler -{ - public class LSL_BuiltIn_Commands_TestImplementation //: LSL_BuiltIn_Commands_Interface - { - public LSL_BuiltIn_Commands_TestImplementation(string FullScriptID) - { - Common.SendToDebug("LSL_BuiltIn_Commands_TestImplementation: Creating object for FullScriptID: " + FullScriptID); - } - - - public float llSin(float f) { return 0; } - public float llCos(float f) { return 0; } - public float llTan(float f) { return 0; } - public float llAtan2(float x, float y) { return 0; } - public float llSqrt(float f) { return 0; } - public float llPow(float fbase, float fexponent) { return 0; } - public UInt32 llAbs(UInt32 i) { return 0; } - public float llFabs(float f) { return 0; } - public float llFrand(float mag) { return 0; } - public UInt32 llFloor(float f) { return 0; } - public UInt32 llCeil(float f) { return 0; } - public UInt32 llRound(float f) { return 0; } - public float llVecMag(Axiom.Math.Vector3 v) { return 0; } - public Axiom.Math.Vector3 llVecNorm(Axiom.Math.Vector3 v) { return new Axiom.Math.Vector3(); } - public float llVecDist(Axiom.Math.Vector3 a, Axiom.Math.Vector3 b) { return 0; } - public Axiom.Math.Vector3 llRot2Euler(Axiom.Math.Quaternion r) { return new Axiom.Math.Vector3(); } - public Axiom.Math.Quaternion llEuler2Rot(Axiom.Math.Vector3 v) { return new Axiom.Math.Quaternion(); } - public Axiom.Math.Quaternion llAxes2Rot(Axiom.Math.Vector3 fwd, Axiom.Math.Vector3 left, Axiom.Math.Vector3 up) { return new Axiom.Math.Quaternion(); } - public Axiom.Math.Vector3 llRot2Fwd(Axiom.Math.Quaternion r) { return new Axiom.Math.Vector3(); } - public Axiom.Math.Vector3 llRot2Left(Axiom.Math.Quaternion r) { return new Axiom.Math.Vector3(); } - public Axiom.Math.Vector3 llRot2Up(Axiom.Math.Quaternion r) { return new Axiom.Math.Vector3(); } - public Axiom.Math.Quaternion llRotBetween(Axiom.Math.Vector3 start, Axiom.Math.Vector3 end) { return new Axiom.Math.Quaternion(); } - public void llWhisper(UInt16 channelID, string text) - { - Common.SendToDebug("INTERNAL FUNCTION llWhisper(" + channelID + ", \"" + text + "\");"); - Common.SendToLog("llWhisper Channel " + channelID + ", Text: \"" + text + "\""); - } - //public void llSay(UInt32 channelID, string text) - public void llSay(object channelID, object text) - { - //TODO: DO SOMETHING USEFUL HERE - Common.SendToDebug("INTERNAL FUNCTION llSay(" + (UInt32)channelID + ", \"" + (string)text + "\");"); - Common.SendToLog("llSay Channel " + (UInt32)channelID + ", Text: \"" + (string)text + "\""); - } - public void llShout(UInt16 channelID, string text) { return; } - public UInt32 llListen(UInt16 channelID, string name, string ID, string msg) { return 0; } - public void llListenControl(UInt32 number, UInt32 active) { return; } - public void llListenRemove(UInt32 number) { return; } - public void llSensor(string name, string id, UInt32 type, float range, float arc) { return; } - public void llSensorRepeat(string name, string id, UInt32 type, float range, float arc, float rate) { return; } - public void llSensorRemove() { return; } - public string llDetectedName(UInt32 number) { return ""; } - public string llDetectedKey(UInt32 number) { return ""; } - public string llDetectedOwner(UInt32 number) { return ""; } - public UInt32 llDetectedType(UInt32 number) { return 0; } - public Axiom.Math.Vector3 llDetectedPos(UInt32 number) { return new Axiom.Math.Vector3(); } - public Axiom.Math.Vector3 llDetectedVel(UInt32 number) { return new Axiom.Math.Vector3(); } - public Axiom.Math.Vector3 llDetectedGrab(UInt32 number) { return new Axiom.Math.Vector3(); } - public Axiom.Math.Quaternion llDetectedRot(UInt32 number) { return new Axiom.Math.Quaternion(); } - public UInt32 llDetectedGroup(UInt32 number) { return 0; } - public UInt32 llDetectedLinkNumber(UInt32 number) { return 0; } - public void llDie() { return; } - public float llGround(Axiom.Math.Vector3 offset) { return 0; } - public float llCloud(Axiom.Math.Vector3 offset) { return 0; } - public Axiom.Math.Vector3 llWind(Axiom.Math.Vector3 offset) { return new Axiom.Math.Vector3(); } - public void llSetStatus(UInt32 status, UInt32 value) { return; } - public UInt32 llGetStatus(UInt32 status) { return 0; } - public void llSetScale(Axiom.Math.Vector3 scale) { return; } - public Axiom.Math.Vector3 llGetScale() { return new Axiom.Math.Vector3(); } - public void llSetColor(Axiom.Math.Vector3 color, UInt32 face) { return; } - public float llGetAlpha(UInt32 face) { return 0; } - public void llSetAlpha(float alpha, UInt32 face) { return; } - public Axiom.Math.Vector3 llGetColor(UInt32 face) { return new Axiom.Math.Vector3(); } - public void llSetTexture(string texture, UInt32 face) { return; } - public void llScaleTexture(float u, float v, UInt32 face) { return; } - public void llOffsetTexture(float u, float v, UInt32 face) { return; } - public void llRotateTexture(float rotation, UInt32 face) { return; } - public string llGetTexture(UInt32 face) { return ""; } - public void llSetPos(Axiom.Math.Vector3 pos) { return; } - - - public void llGetPos() { } - public void llGetLocalPos() { } - public void llSetRot() { } - public void llGetRot() { } - public void llGetLocalRot() { } - public void llSetForce() { } - public void llGetForce() { } - public void llTarget() { } - public void llTargetRemove() { } - public void llRotTarget() { } - public void llRotTargetRemove() { } - public void llMoveToTarget() { } - public void llStopMoveToTarget() { } - public void llApplyImpulse() { } - public void llApplyRotationalImpulse() { } - public void llSetTorque() { } - public void llGetTorque() { } - public void llSetForceAndTorque() { } - public void llGetVel() { } - public void llGetAccel() { } - public void llGetOmega() { } - public void llGetTimeOfDay() { } - public void llGetWallclock() { } - public void llGetTime() { } - public void llResetTime() { } - public void llGetAndResetTime() { } - public void llSound() { } - public void llPlaySound() { } - public void llLoopSound() { } - public void llLoopSoundMaster() { } - public void llLoopSoundSlave() { } - public void llPlaySoundSlave() { } - public void llTriggerSound() { } - public void llStopSound() { } - public void llPreloadSound() { } - public void llGetSubString() { } - public void llDeleteSubString() { } - public void llInsertString() { } - public void llToUpper() { } - public void llToLower() { } - public void llGiveMoney() { } - public void llMakeExplosion() { } - public void llMakeFountain() { } - public void llMakeSmoke() { } - public void llMakeFire() { } - public void llRezObject() { } - public void llLookAt() { } - public void llStopLookAt() { } - public void llSetTimerEvent() { } - public void llSleep() { } - public void llGetMass() { } - public void llCollisionFilter() { } - public void llTakeControls() { } - public void llReleaseControls() { } - public void llAttachToAvatar() { } - public void llDetachFromAvatar() { } - public void llTakeCamera() { } - public void llReleaseCamera() { } - public void llGetOwner() { } - public void llInstantMessage() { } - public void llEmail() { } - public void llGetNextEmail() { } - public void llGetKey() { } - public void llSetBuoyancy() { } - public void llSetHoverHeight() { } - public void llStopHover() { } - public void llMinEventDelay() { } - public void llSoundPreload() { } - public void llRotLookAt() { } - public void llStringLength() { } - public void llStartAnimation() { } - public void llStopAnimation() { } - public void llPointAt() { } - public void llStopPointAt() { } - public void llTargetOmega() { } - public void llGetStartParameter() { } - public void llGodLikeRezObject() { } - public void llRequestPermissions() { } - public void llGetPermissionsKey() { } - public void llGetPermissions() { } - public void llGetLinkNumber() { } - public void llSetLinkColor() { } - public void llCreateLink() { } - public void llBreakLink() { } - public void llBreakAllLinks() { } - public void llGetLinkKey() { } - public void llGetLinkName() { } - public void llGetInventoryNumber() { } - public void llGetInventoryName() { } - public void llSetScriptState() { } - public void llGetEnergy() { } - public void llGiveInventory() { } - public void llRemoveInventory() { } - public void llSetText() { } - public void llWater() { } - public void llPassTouches() { } - public void llRequestAgentData() { } - public void llRequestInventoryData() { } - public void llSetDamage() { } - public void llTeleportAgentHome() { } - public void llModifyLand() { } - public void llCollisionSound() { } - public void llCollisionSprite() { } - public void llGetAnimation() { } - public void llResetScript() { } - public void llMessageLinked() { } - public void llPushObject() { } - public void llPassCollisions() { } - public void llGetScriptName() { } - public void llGetNumberOfSides() { } - public void llAxisAngle2Rot() { } - public void llRot2Axis() { } - public void llRot2Angle() { } - public void llAcos() { } - public void llAsin() { } - public void llAngleBetween() { } - public void llGetInventoryKey() { } - public void llAllowInventoryDrop() { } - public void llGetSunDirection() { } - public void llGetTextureOffset() { } - public void llGetTextureScale() { } - public void llGetTextureRot() { } - public void llSubStringIndex() { } - public void llGetOwnerKey() { } - public void llGetCenterOfMass() { } - public void llListSort() { } - public void llGetListLength() { } - public void llList2Integer() { } - public void llList2Float() { } - public void llList2String() { } - public void llList2Key() { } - public void llList2Vector() { } - public void llList2Rot() { } - public void llList2List() { } - public void llDeleteSubList() { } - public void llGetListEntryType() { } - public void llList2CSV() { } - public void llCSV2List() { } - public void llListRandomize() { } - public void llList2ListStrided() { } - public void llGetRegionCorner() { } - public void llListInsertList() { } - public void llListFindList() { } - public void llGetObjectName() { } - public void llSetObjectName() { } - public void llGetDate() { } - public void llEdgeOfWorld() { } - public void llGetAgentInfo() { } - public void llAdjustSoundVolume() { } - public void llSetSoundQueueing() { } - public void llSetSoundRadius() { } - public void llKey2Name() { } - public void llSetTextureAnim() { } - public void llTriggerSoundLimited() { } - public void llEjectFromLand() { } - public void llParseString2List() { } - public void llOverMyLand() { } - public void llGetLandOwnerAt() { } - public void llGetNotecardLine() { } - public void llGetAgentSize() { } - public void llSameGroup() { } - public void llUnSit() { } - public void llGroundSlope() { } - public void llGroundNormal() { } - public void llGroundContour() { } - public void llGetAttached() { } - public void llGetFreeMemory() { } - public void llGetRegionName() { } - public void llGetRegionTimeDilation() { } - public void llGetRegionFPS() { } - public void llParticleSystem() { } - public void llGroundRepel() { } - public void llGiveInventoryList() { } - public void llSetVehicleType() { } - public void llSetVehicleFloatParam() { } - public void llSetVehicleVectorParam() { } - public void llSetVehicleRotationParam() { } - public void llSetVehicleFlags() { } - public void llRemoveVehicleFlags() { } - public void llSitTarget() { } - public void llAvatarOnSitTarget() { } - public void llAddToLandPassList() { } - public void llSetTouchText() { } - public void llSetSitText() { } - public void llSetCameraEyeOffset() { } - public void llSetCameraAtOffset() { } - public void llDumpList2String() { } - public void llScriptDanger() { } - public void llDialog() { } - public void llVolumeDetect() { } - public void llResetOtherScript() { } - public void llGetScriptState() { } - public void llRemoteLoadScript() { } - public void llSetRemoteScriptAccessPin() { } - public void llRemoteLoadScriptPin() { } - public void llOpenRemoteDataChannel() { } - public void llSendRemoteData() { } - public void llRemoteDataReply() { } - public void llCloseRemoteDataChannel() { } - public void llMD5String() { } - public void llSetPrimitiveParams() { } - public void llStringToBase64() { } - public void llBase64ToString() { } - public void llXorBase64Strings() { } - public void llRemoteDataSetRegion() { } - public void llLog10() { } - public void llLog() { } - public void llGetAnimationList() { } - public void llSetParcelMusicURL() { } - public void llGetRootPosition() { } - public void llGetRootRotation() { } - public void llGetObjectDesc() { } - public void llSetObjectDesc() { } - public void llGetCreator() { } - public void llGetTimestamp() { } - public void llSetLinkAlpha() { } - public void llGetNumberOfPrims() { } - public void llGetNumberOfNotecardLines() { } - public void llGetBoundingBox() { } - public void llGetGeometricCenter() { } - public void llGetPrimitiveParams() { } - public void llIntegerToBase64() { } - public void llBase64ToInteger() { } - public void llGetGMTclock() { } - public void llGetSimulatorHostname() { } - public void llSetLocalRot() { } - public void llParseStringKeepNulls() { } - public void llRezAtRoot() { } - public void llGetObjectPermMask() { } - public void llSetObjectPermMask() { } - public void llGetInventoryPermMask() { } - public void llSetInventoryPermMask() { } - public void llGetInventoryCreator() { } - public void llOwnerSay() { } - public void llRequestSimulatorData() { } - public void llForceMouselook() { } - public void llGetObjectMass() { } - public void llListReplaceList() { } - public void llLoadURL() { } - public void llParcelMediaCommandList() { } - public void llParcelMediaQuery() { } - public void llModPow() { } - public void llGetInventoryType() { } - public void llSetPayPrice() { } - public void llGetCameraPos() { } - public void llGetCameraRot() { } - public void llSetPrimURL() { } - public void llRefreshPrimURL() { } - public void llEscapeURL() { } - public void llUnescapeURL() { } - public void llMapDestination() { } - public void llAddToLandBanList() { } - public void llRemoveFromLandPassList() { } - public void llRemoveFromLandBanList() { } - public void llSetCameraParams() { } - public void llClearCameraParams() { } - public void llListStatistics() { } - public void llGetUnixTime() { } - public void llGetParcelFlags() { } - public void llGetRegionFlags() { } - public void llXorBase64StringsCorrect() { } - public void llHTTPRequest() { } - public void llResetLandBanList() { } - public void llResetLandPassList() { } - public void llGetParcelPrimCount() { } - public void llGetParcelPrimOwners() { } - public void llGetObjectPrimCount() { } - public void llGetParcelMaxPrims() { } - public void llGetParcelDetails() { } - - - - } -} diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs index 7ad00d1..25db231 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs @@ -44,12 +44,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine { myScriptEngine = _ScriptEngine; // TODO: HOOK EVENTS UP TO SERVER! - Common.SendToDebug("EventManager Start"); - + myScriptEngine.m_logger.Verbose("ScriptEngine", "EventManager Start"); // TODO: ADD SERVER HOOK TO LOAD A SCRIPT THROUGH myScriptEngine.ScriptManager // Hook up a test event to our test form - Common.SendToDebug("EventManager Hooking up dummy-event: touch_start"); + myScriptEngine.m_logger.Verbose("ScriptEngine", "EventManager Hooking up dummy-event: touch_start"); // TODO: REPLACE THIS WITH A REAL TOUCH_START EVENT IN SERVER myScriptEngine.World.EventManager.OnObjectGrab += new OpenSim.Region.Environment.Scenes.EventManager.ObjectGrabDelegate(touch_start); //myScriptEngine.World.touch_start += new TempWorldInterfaceEventDelegates.touch_start(touch_start); @@ -58,7 +57,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine public void touch_start(uint localID, LLVector3 offsetPos, IClientAPI remoteClient) { // Add to queue for all scripts in ObjectID object - Common.SendToDebug("EventManager Event: touch_start"); + myScriptEngine.m_logger.Verbose("ScriptEngine", "EventManager Event: touch_start"); myScriptEngine.myEventQueueManager.AddToObjectQueue("TEST", "touch_start", new object[] { (int)0 }); } diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs index 59f669b..0d8c160 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs @@ -51,7 +51,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine public EventQueueManager(ScriptEngine _ScriptEngine) { myScriptEngine = _ScriptEngine; - Common.SendToDebug("EventQueueManager Start"); + myScriptEngine.m_logger.Verbose("ScriptEngine", "EventQueueManager Start"); // Start worker thread EventQueueThread = new Thread(EventQueueThreadLoop); EventQueueThread.IsBackground = true; @@ -70,7 +70,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine } catch (Exception e) { - Common.SendToDebug("EventQueueManager Exception killing worker thread: " + e.ToString()); + myScriptEngine.m_logger.Verbose("ScriptEngine", "EventQueueManager Exception killing worker thread: " + e.ToString()); } } // Todo: Clean up our queues @@ -79,7 +79,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine private void EventQueueThreadLoop() { - Common.SendToDebug("EventQueueManager Worker thread spawned"); + myScriptEngine.m_logger.Verbose("ScriptEngine", "EventQueueManager Worker thread spawned"); try { while (true) @@ -93,7 +93,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine { // Something in queue, process QueueItemStruct QIS = EventQueue.Dequeue(); - Common.SendToDebug("Processing event for ObjectID: " + QIS.ObjectID + ", ScriptID: " + QIS.ScriptID + ", FunctionName: " + QIS.FunctionName); + myScriptEngine.m_logger.Verbose("ScriptEngine", "Processing event for ObjectID: " + QIS.ObjectID + ", ScriptID: " + QIS.ScriptID + ", FunctionName: " + QIS.FunctionName); // TODO: Execute function myScriptEngine.myScriptManager.ExecuteFunction(QIS.ObjectID, QIS.ScriptID, QIS.FunctionName, QIS.param); } @@ -101,14 +101,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine } catch (ThreadAbortException tae) { - Common.SendToDebug("EventQueueManager Worker thread killed: " + tae.Message); + myScriptEngine.m_logger.Verbose("ScriptEngine", "EventQueueManager Worker thread killed: " + tae.Message); } } public void AddToObjectQueue(string ObjectID, string FunctionName, object[] param) { // Determine all scripts in Object and add to their queue - Common.SendToDebug("EventQueueManager Adding ObjectID: " + ObjectID + ", FunctionName: " + FunctionName); + myScriptEngine.m_logger.Verbose("ScriptEngine", "EventQueueManager Adding ObjectID: " + ObjectID + ", FunctionName: " + FunctionName); foreach (string ScriptID in myScriptEngine.myScriptManager.GetScriptKeys(ObjectID)) { diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs index 4a09cf3..bcfc06d 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs @@ -42,16 +42,20 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine internal EventManager myEventManager; // Handles and queues incoming events from OpenSim internal EventQueueManager myEventQueueManager; // Executes events internal ScriptManager myScriptManager; // Load, unload and execute scripts + internal OpenSim.Framework.Console.LogBase m_logger; public ScriptEngine() { - Common.SendToDebug("ScriptEngine Object Initialized"); + //Common.SendToDebug("ScriptEngine Object Initialized"); + Common.mySE = this; } - public void InitializeEngine(OpenSim.Region.Environment.Scenes.Scene Sceneworld) + public void InitializeEngine(OpenSim.Region.Environment.Scenes.Scene Sceneworld, OpenSim.Framework.Console.LogBase logger) { World = Sceneworld; - Common.SendToDebug("ScriptEngine InitializeEngine()"); + m_logger = logger; + + m_logger.Status("ScriptEngine", "InitializeEngine"); // Create all objects we'll be using myEventQueueManager = new EventQueueManager(this); @@ -71,7 +75,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine [Obsolete("!!!FOR DEBUGGING ONLY!!!")] public void StartScript(string ScriptID, string ObjectID) { - Common.SendToDebug("ScriptEngine DEBUG: StartScript: " + ScriptID); + m_logger.Status("ScriptEngine", "DEBUG: StartScript: " + ScriptID); myScriptManager.StartScript(ScriptID, ObjectID); } } diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs index 0c5bfc2..0c4adc1 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs @@ -41,7 +41,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine public ScriptManager(ScriptEngine _ScriptEngine) { myScriptEngine = _ScriptEngine; - Common.SendToDebug("ScriptManager Start"); + myScriptEngine.m_logger.Verbose("ScriptEngine", "ScriptManager Start"); } @@ -102,7 +102,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine /// public void StartScript(string ScriptID, string ObjectID) { - Common.SendToDebug("ScriptManager StartScript: ScriptID: " + ScriptID + ", ObjectID: " + ObjectID); + myScriptEngine.m_logger.Verbose("ScriptEngine", "ScriptManager StartScript: ScriptID: " + ScriptID + ", ObjectID: " + ObjectID); // We will initialize and start the script. // It will be up to the script itself to hook up the correct events. @@ -114,13 +114,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine FileName = ScriptID; // * Does script need compile? Send it to LSL compiler first. (TODO: Use (and clean) compiler cache) - Common.SendToDebug("ScriptManager Script extension: " + System.IO.Path.GetExtension(FileName).ToLower()); + myScriptEngine.m_logger.Verbose("ScriptEngine", "ScriptManager Script extension: " + System.IO.Path.GetExtension(FileName).ToLower()); switch (System.IO.Path.GetExtension(FileName).ToLower()) { case ".txt": case ".lsl": case ".cs": - Common.SendToDebug("ScriptManager Script is CS/LSL, compiling to .Net Assembly"); + myScriptEngine.m_logger.Verbose("ScriptEngine", "ScriptManager Script is CS/LSL, compiling to .Net Assembly"); // Create a new instance of the compiler (currently we don't want reuse) OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.Compiler LSLCompiler = new OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.Compiler(); // Compile @@ -130,7 +130,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine throw new Exception("Unknown script type."); } - Common.SendToDebug("Compilation done"); + myScriptEngine.m_logger.Verbose("ScriptEngine", "Compilation done"); // * Insert yield into code FileName = ProcessYield(FileName); @@ -149,7 +149,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine //OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL_BuiltIn_Commands_Interface LSLB = new OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL_BuiltIn_Commands_TestImplementation(FullScriptID); // Start the script - giving it BuiltIns - Common.SendToDebug("ScriptManager initializing script, handing over private builtin command interface"); + myScriptEngine.m_logger.Verbose("ScriptEngine", "ScriptManager initializing script, handing over private builtin command interface"); Script.Start(myScriptEngine.World, ScriptID); @@ -174,7 +174,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine /// private OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass LoadAndInitAssembly(AppDomain FreeAppDomain, string FileName) { - Common.SendToDebug("ScriptManager Loading Assembly " + FileName); + myScriptEngine.m_logger.Verbose("ScriptEngine", "ScriptManager Loading Assembly " + FileName); // Load .Net Assembly (.dll) // Initialize and return it @@ -218,7 +218,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine internal void ExecuteFunction(string ObjectID, string ScriptID, string FunctionName, object[] args) { - Common.SendToDebug("Executing Function ObjectID: " + ObjectID + ", ScriptID: " + ScriptID + ", FunctionName: " + FunctionName); + myScriptEngine.m_logger.Verbose("ScriptEngine", "Executing Function ObjectID: " + ObjectID + ", ScriptID: " + ScriptID + ", FunctionName: " + FunctionName); OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass Script = myScriptEngine.myScriptManager.GetScript(ObjectID, ScriptID); Type type = Script.GetType(); @@ -226,7 +226,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine //System.Collections.Generic.List Functions = (System.Collections.Generic.List) //Type type = typeof(OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO.LSL_BaseClass); - Common.SendToDebug("Invoke: \"" + Script.State + "_event_" + FunctionName + "\""); + myScriptEngine.m_logger.Verbose("ScriptEngine", "Invoke: \"" + Script.State + "_event_" + FunctionName + "\""); type.InvokeMember(Script.State + "_event_" + FunctionName, BindingFlags.InvokeMethod, null, Script, args); //System.Collections.Generic.List Functions = (System.Collections.Generic.List)type.InvokeMember("GetFunctions", BindingFlags.InvokeMethod, null, Script, null); -- cgit v1.1