aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ExtensionsScriptModule
diff options
context:
space:
mode:
authorJeff Ames2008-02-05 19:44:27 +0000
committerJeff Ames2008-02-05 19:44:27 +0000
commit6ed5283bc06a62f38eb517e67b975832b603bf61 (patch)
treee5f635018789b73a99ddeca0883a68368fa5eece /OpenSim/Region/ExtensionsScriptModule
parentCut down on the number of packets sent during terraforming. Terraforming shou... (diff)
downloadopensim-SC-6ed5283bc06a62f38eb517e67b975832b603bf61.zip
opensim-SC-6ed5283bc06a62f38eb517e67b975832b603bf61.tar.gz
opensim-SC-6ed5283bc06a62f38eb517e67b975832b603bf61.tar.bz2
opensim-SC-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/ExtensionsScriptModule/Engines/CSharp/CSharpScriptEngine.cs6
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JScript/JScriptEngine.cs6
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Script.cs6
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/ScriptInfo.cs11
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedAPI.cs6
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs12
6 files changed, 29 insertions, 18 deletions
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/CSharpScriptEngine.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/CSharpScriptEngine.cs
index b625f43..03d478f 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/CSharpScriptEngine.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/CSharpScriptEngine.cs
@@ -35,6 +35,8 @@ namespace OpenSim.Region.ExtensionsScriptModule.CSharp
35{ 35{
36 public class CSharpScriptEngine : IScriptCompiler 36 public class CSharpScriptEngine : IScriptCompiler
37 { 37 {
38 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
39
38 public string FileExt() 40 public string FileExt()
39 { 41 {
40 return ".cs"; 42 return ".cs";
@@ -58,10 +60,10 @@ namespace OpenSim.Region.ExtensionsScriptModule.CSharp
58 60
59 if (compilerResults.Errors.Count > 0) 61 if (compilerResults.Errors.Count > 0)
60 { 62 {
61 MainLog.Instance.Error("Compile errors"); 63 m_log.Error("Compile errors");
62 foreach (CompilerError error in compilerResults.Errors) 64 foreach (CompilerError error in compilerResults.Errors)
63 { 65 {
64 MainLog.Instance.Error(error.Line.ToString() + ": " + error.ErrorText.ToString()); 66 m_log.Error(error.Line.ToString() + ": " + error.ErrorText.ToString());
65 } 67 }
66 } 68 }
67 else 69 else
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JScript/JScriptEngine.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JScript/JScriptEngine.cs
index bc5c413..dbe0dca 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JScript/JScriptEngine.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JScript/JScriptEngine.cs
@@ -35,6 +35,8 @@ namespace OpenSim.Region.ExtensionsScriptModule.JScript
35{ 35{
36 public class JScriptEngine : IScriptCompiler 36 public class JScriptEngine : IScriptCompiler
37 { 37 {
38 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
39
38 public string FileExt() 40 public string FileExt()
39 { 41 {
40 return ".js"; 42 return ".js";
@@ -58,10 +60,10 @@ namespace OpenSim.Region.ExtensionsScriptModule.JScript
58 60
59 if (compilerResults.Errors.Count > 0) 61 if (compilerResults.Errors.Count > 0)
60 { 62 {
61 MainLog.Instance.Error("Compile errors"); 63 m_log.Error("Compile errors");
62 foreach (CompilerError error in compilerResults.Errors) 64 foreach (CompilerError error in compilerResults.Errors)
63 { 65 {
64 MainLog.Instance.Error(error.Line.ToString() + ": " + error.ErrorText.ToString()); 66 m_log.Error(error.Line.ToString() + ": " + error.ErrorText.ToString());
65 } 67 }
66 } 68 }
67 else 69 else
diff --git a/OpenSim/Region/ExtensionsScriptModule/Script.cs b/OpenSim/Region/ExtensionsScriptModule/Script.cs
index 0555277..d9d569b 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Script.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Script.cs
@@ -53,12 +53,12 @@ namespace OpenSim.Region.ExtensionsScriptModule
53 53
54 private void events_OnNewPresence(ScenePresence presence) 54 private void events_OnNewPresence(ScenePresence presence)
55 { 55 {
56 script.logger.Verbose("TESTSCRIPT", "Hello " + presence.Firstname.ToString() + "!"); 56 script.Log.Info("[TESTSCRIPT]: Hello " + presence.Firstname.ToString() + "!");
57 } 57 }
58 58
59 private void events_OnFrame() 59 private void events_OnFrame()
60 { 60 {
61 //script.logger.Verbose("TESTSCRIPT", "Hello World!"); 61 //script.logger.Info("[TESTSCRIPT]: Hello World!");
62 } 62 }
63 } 63 }
64} \ No newline at end of file 64}
diff --git a/OpenSim/Region/ExtensionsScriptModule/ScriptInfo.cs b/OpenSim/Region/ExtensionsScriptModule/ScriptInfo.cs
index af54a4e..e90bfc1 100644
--- a/OpenSim/Region/ExtensionsScriptModule/ScriptInfo.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/ScriptInfo.cs
@@ -36,23 +36,26 @@ namespace OpenSim.Region.ExtensionsScriptModule
36 /// </summary> 36 /// </summary>
37 public class ScriptInfo 37 public class ScriptInfo
38 { 38 {
39 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
40
39 // Reference to world.eventsManager provided for convenience 41 // Reference to world.eventsManager provided for convenience
40 public EventManager events; 42 public EventManager events;
41 43
42 // The main world 44 // The main world
43 public Scene world; 45 public Scene world;
44 46
45 // The console
46 public LogBase logger;
47
48 // API Access 47 // API Access
49 public ScriptAPI api; 48 public ScriptAPI api;
50 49
50 public log4net.ILog Log
51 {
52 get { return m_log; }
53 }
54
51 public ScriptInfo(Scene scene) 55 public ScriptInfo(Scene scene)
52 { 56 {
53 world = scene; 57 world = scene;
54 events = world.EventManager; 58 events = world.EventManager;
55 logger = MainLog.Instance;
56 api = new ScriptAPI(world, LLUUID.Zero); 59 api = new ScriptAPI(world, LLUUID.Zero);
57 } 60 }
58 61
diff --git a/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedAPI.cs b/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedAPI.cs
index b3a0d4f..0f50358 100644
--- a/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedAPI.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/ScriptInterpretedAPI.cs
@@ -45,6 +45,8 @@ namespace OpenSim.Region.ExtensionsScriptModule
45 /// <remarks>Avoid at all costs. This should ONLY be used for LSL.</remarks> 45 /// <remarks>Avoid at all costs. This should ONLY be used for LSL.</remarks>
46 internal class ScriptInterpretedAPI 46 internal class ScriptInterpretedAPI
47 { 47 {
48 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
49
48 protected Key m_object; 50 protected Key m_object;
49 protected Scene m_scene; 51 protected Scene m_scene;
50 52
@@ -109,7 +111,7 @@ namespace OpenSim.Region.ExtensionsScriptModule
109 { 111 {
110 //Dont do anything! 112 //Dont do anything!
111 } 113 }
112 MainLog.Instance.Warn("script", 114 m_log.Warn("[script]: " +
113 "Unimplemented function called by script: osAddToLandPassList(Key avatar, float hours)"); 115 "Unimplemented function called by script: osAddToLandPassList(Key avatar, float hours)");
114 return; 116 return;
115 } 117 }
@@ -117,7 +119,7 @@ namespace OpenSim.Region.ExtensionsScriptModule
117 [Obsolete("Unimplemented")] 119 [Obsolete("Unimplemented")]
118 public void osAdjustSoundVolume(float volume) 120 public void osAdjustSoundVolume(float volume)
119 { 121 {
120 MainLog.Instance.Warn("script", "Unimplemented function called by script: osAdjustSoundVolume(float volume)"); 122 m_log.Warn("[script]: Unimplemented function called by script: osAdjustSoundVolume(float volume)");
121 return; 123 return;
122 } 124 }
123 125
diff --git a/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs b/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs
index d080ab8..6c2d940 100644
--- a/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs
@@ -38,6 +38,8 @@ namespace OpenSim.Region.ExtensionsScriptModule
38{ 38{
39 public class ScriptManager : IRegionModule, IExtensionScriptModule 39 public class ScriptManager : IRegionModule, IExtensionScriptModule
40 { 40 {
41 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
42
41 private readonly List<IScript> scripts = new List<IScript>(); 43 private readonly List<IScript> scripts = new List<IScript>();
42 private Scene m_scene; 44 private Scene m_scene;
43 private readonly Dictionary<string, IScriptCompiler> compilers = new Dictionary<string, IScriptCompiler>(); 45 private readonly Dictionary<string, IScriptCompiler> compilers = new Dictionary<string, IScriptCompiler>();
@@ -48,12 +50,12 @@ namespace OpenSim.Region.ExtensionsScriptModule
48 { 50 {
49 ScriptInfo scriptInfo = new ScriptInfo(m_scene); 51 ScriptInfo scriptInfo = new ScriptInfo(m_scene);
50 // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script. 52 // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script.
51 MainLog.Instance.Verbose("SCRIPT", "Loading " + script.Key); 53 m_log.Info("[SCRIPT]: Loading " + script.Key);
52 script.Value.Initialise(scriptInfo); 54 script.Value.Initialise(scriptInfo);
53 scripts.Add(script.Value); 55 scripts.Add(script.Value);
54 } 56 }
55 57
56 MainLog.Instance.Verbose("SCRIPT", string.Format("Finished loading {0} script(s)", compiledscripts.Count)); 58 m_log.Info("[SCRIPT]: " + string.Format("Finished loading {0} script(s)", compiledscripts.Count));
57 } 59 }
58 60
59 public ScriptManager() 61 public ScriptManager()
@@ -71,7 +73,7 @@ namespace OpenSim.Region.ExtensionsScriptModule
71 73
72 public void Initialise(Scene scene, IConfigSource config) 74 public void Initialise(Scene scene, IConfigSource config)
73 { 75 {
74 MainLog.Instance.Verbose("SCRIPTMODULE", "Initialising Extensions Scripting Module"); 76 m_log.Info("[SCRIPTMODULE]: Initialising Extensions Scripting Module");
75 m_scene = scene; 77 m_scene = scene;
76 78
77 m_scene.RegisterModuleInterface<IExtensionScriptModule>(this); 79 m_scene.RegisterModuleInterface<IExtensionScriptModule>(this);
@@ -118,14 +120,14 @@ namespace OpenSim.Region.ExtensionsScriptModule
118 break; 120 break;
119 121
120 default: 122 default:
121 MainLog.Instance.Error("Unknown script command"); 123 m_log.Error("Unknown script command");
122 break; 124 break;
123 } 125 }
124 } 126 }
125 127
126 public bool AddPreCompiledScript(IScript script) 128 public bool AddPreCompiledScript(IScript script)
127 { 129 {
128 MainLog.Instance.Verbose("SCRIPT", "Loading script " + script.Name); 130 m_log.Info("[SCRIPT]: Loading script " + script.Name);
129 ScriptInfo scriptInfo = new ScriptInfo(m_scene); 131 ScriptInfo scriptInfo = new ScriptInfo(m_scene);
130 // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script. 132 // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script.
131 script.Initialise(scriptInfo); 133 script.Initialise(scriptInfo);