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/DotNetEngine/Compiler/LSL/Compiler.cs | |
parent | Cut down on the number of packets sent during terraforming. Terraforming shou... (diff) | |
download | opensim-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 'OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs index 3451cce..2f985e4 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs | |||
@@ -40,7 +40,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
40 | { | 40 | { |
41 | public class Compiler | 41 | public class Compiler |
42 | { | 42 | { |
43 | |||
44 | // * Uses "LSL2Converter" to convert LSL to C# if necessary. | 43 | // * Uses "LSL2Converter" to convert LSL to C# if necessary. |
45 | // * Compiles C#-code into an assembly | 44 | // * Compiles C#-code into an assembly |
46 | // * Returns assembly name ready for AppDomain load. | 45 | // * Returns assembly name ready for AppDomain load. |
@@ -113,7 +112,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
113 | AllowedCompilers.Clear(); | 112 | AllowedCompilers.Clear(); |
114 | 113 | ||
115 | #if DEBUG | 114 | #if DEBUG |
116 | m_scriptEngine.Log.Debug(m_scriptEngine.ScriptEngineName, "Allowed languages: " + allowComp); | 115 | m_scriptEngine.Log.Debug("[" + m_scriptEngine.ScriptEngineName + "]: Allowed languages: " + allowComp); |
117 | #endif | 116 | #endif |
118 | 117 | ||
119 | 118 | ||
@@ -122,18 +121,18 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
122 | string strlan = strl.Trim(" \t".ToCharArray()).ToLower(); | 121 | string strlan = strl.Trim(" \t".ToCharArray()).ToLower(); |
123 | if (!LanguageMapping.ContainsKey(strlan)) | 122 | if (!LanguageMapping.ContainsKey(strlan)) |
124 | { | 123 | { |
125 | m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Config error. Compiler is unable to recongnize language type \"" + strlan + "\" specified in \"AllowedCompilers\"."); | 124 | m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: Config error. Compiler is unable to recongnize language type \"" + strlan + "\" specified in \"AllowedCompilers\"."); |
126 | } | 125 | } |
127 | else | 126 | else |
128 | { | 127 | { |
129 | #if DEBUG | 128 | #if DEBUG |
130 | m_scriptEngine.Log.Debug(m_scriptEngine.ScriptEngineName, "Config OK. Compiler recongnized language type \"" + strlan + "\" specified in \"AllowedCompilers\"."); | 129 | m_scriptEngine.Log.Debug("[" + m_scriptEngine.ScriptEngineName + "]: Config OK. Compiler recongnized language type \"" + strlan + "\" specified in \"AllowedCompilers\"."); |
131 | #endif | 130 | #endif |
132 | } | 131 | } |
133 | AllowedCompilers.Add(strlan, true); | 132 | AllowedCompilers.Add(strlan, true); |
134 | } | 133 | } |
135 | if (AllowedCompilers.Count == 0) | 134 | if (AllowedCompilers.Count == 0) |
136 | m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Config error. Compiler could not recognize any language in \"AllowedCompilers\". Scripts will not be executed!"); | 135 | m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: Config error. Compiler could not recognize any language in \"AllowedCompilers\". Scripts will not be executed!"); |
137 | 136 | ||
138 | // Default language | 137 | // Default language |
139 | string defaultCompileLanguage = m_scriptEngine.ScriptConfigSource.GetString("DefaultCompileLanguage", "lsl").ToLower(); | 138 | string defaultCompileLanguage = m_scriptEngine.ScriptConfigSource.GetString("DefaultCompileLanguage", "lsl").ToLower(); |
@@ -141,22 +140,22 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
141 | // Is this language recognized at all? | 140 | // Is this language recognized at all? |
142 | if (!LanguageMapping.ContainsKey(defaultCompileLanguage)) | 141 | if (!LanguageMapping.ContainsKey(defaultCompileLanguage)) |
143 | { | 142 | { |
144 | m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, | 143 | m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: " + |
145 | "Config error. Default language \"" + defaultCompileLanguage + "\" specified in \"DefaultCompileLanguage\" is not recognized as a valid language. Changing default to: \"lsl\"."); | 144 | "Config error. Default language \"" + defaultCompileLanguage + "\" specified in \"DefaultCompileLanguage\" is not recognized as a valid language. Changing default to: \"lsl\"."); |
146 | defaultCompileLanguage = "lsl"; | 145 | defaultCompileLanguage = "lsl"; |
147 | } | 146 | } |
148 | 147 | ||
149 | // Is this language in allow-list? | 148 | // Is this language in allow-list? |
150 | if (!AllowedCompilers.ContainsKey(defaultCompileLanguage)) | 149 | if (!AllowedCompilers.ContainsKey(defaultCompileLanguage)) |
151 | { | 150 | { |
152 | m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, | 151 | m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: " + |
153 | "Config error. Default language \"" + defaultCompileLanguage + "\"specified in \"DefaultCompileLanguage\" is not in list of \"AllowedCompilers\". Scripts may not be executed!"); | 152 | "Config error. Default language \"" + defaultCompileLanguage + "\"specified in \"DefaultCompileLanguage\" is not in list of \"AllowedCompilers\". Scripts may not be executed!"); |
154 | } | 153 | } |
155 | else | 154 | else |
156 | { | 155 | { |
157 | #if DEBUG | 156 | #if DEBUG |
158 | m_scriptEngine.Log.Debug(m_scriptEngine.ScriptEngineName, | 157 | m_scriptEngine.Log.Debug("[" + m_scriptEngine.ScriptEngineName + "]: " + |
159 | "Config OK. Default language \"" + defaultCompileLanguage + "\" specified in \"DefaultCompileLanguage\" is recognized as a valid language."); | 158 | "Config OK. Default language \"" + defaultCompileLanguage + "\" specified in \"DefaultCompileLanguage\" is recognized as a valid language."); |
160 | #endif | 159 | #endif |
161 | // LANGUAGE IS IN ALLOW-LIST | 160 | // LANGUAGE IS IN ALLOW-LIST |
162 | DefaultCompileLanguage = LanguageMapping[defaultCompileLanguage]; | 161 | DefaultCompileLanguage = LanguageMapping[defaultCompileLanguage]; |
@@ -181,13 +180,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
181 | } | 180 | } |
182 | catch (Exception ex) | 181 | catch (Exception ex) |
183 | { | 182 | { |
184 | m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Exception trying to create ScriptEngine directory \"" + ScriptEnginesPath + "\": " + ex.ToString()); | 183 | m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: Exception trying to create ScriptEngine directory \"" + ScriptEnginesPath + "\": " + ex.ToString()); |
185 | } | 184 | } |
186 | } | 185 | } |
187 | 186 | ||
188 | foreach (string file in Directory.GetFiles(ScriptEnginesPath)) | 187 | foreach (string file in Directory.GetFiles(ScriptEnginesPath)) |
189 | { | 188 | { |
190 | //m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "FILE FOUND: " + file); | 189 | //m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: FILE FOUND: " + file); |
191 | 190 | ||
192 | if (file.ToLower().StartsWith(FilePrefix + "_compiled_") || | 191 | if (file.ToLower().StartsWith(FilePrefix + "_compiled_") || |
193 | file.ToLower().StartsWith(FilePrefix + "_source_")) | 192 | file.ToLower().StartsWith(FilePrefix + "_source_")) |
@@ -198,7 +197,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
198 | } | 197 | } |
199 | catch (Exception ex) | 198 | catch (Exception ex) |
200 | { | 199 | { |
201 | m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Exception trying delete old script file \"" + file + "\": " + ex.ToString()); | 200 | m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: Exception trying delete old script file \"" + file + "\": " + ex.ToString()); |
202 | } | 201 | } |
203 | 202 | ||
204 | } | 203 | } |
@@ -313,7 +312,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
313 | Path.Combine("ScriptEngines", | 312 | Path.Combine("ScriptEngines", |
314 | FilePrefix + "_compiled_" + instanceID.ToString() + "_" + scriptCompileCounter.ToString() + ".dll"); | 313 | FilePrefix + "_compiled_" + instanceID.ToString() + "_" + scriptCompileCounter.ToString() + ".dll"); |
315 | #if DEBUG | 314 | #if DEBUG |
316 | m_scriptEngine.Log.Debug(m_scriptEngine.ScriptEngineName, "Starting compile of \"" + OutFile + "\"."); | 315 | m_scriptEngine.Log.Debug("[" + m_scriptEngine.ScriptEngineName + "]: Starting compile of \"" + OutFile + "\"."); |
317 | #endif | 316 | #endif |
318 | try | 317 | try |
319 | { | 318 | { |
@@ -321,7 +320,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
321 | } | 320 | } |
322 | catch (Exception e) | 321 | catch (Exception e) |
323 | { | 322 | { |
324 | //m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Unable to delete old existring script-file before writing new. Compile aborted: " + e.ToString()); | 323 | //m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: Unable to delete old existring script-file before writing new. Compile aborted: " + e.ToString()); |
325 | throw new Exception("Unable to delete old existring script-file before writing new. Compile aborted: " + e.ToString()); | 324 | throw new Exception("Unable to delete old existring script-file before writing new. Compile aborted: " + e.ToString()); |
326 | } | 325 | } |
327 | //string OutFile = Path.Combine("ScriptEngines", "SecondLife.Script.dll"); | 326 | //string OutFile = Path.Combine("ScriptEngines", "SecondLife.Script.dll"); |
@@ -338,7 +337,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
338 | } | 337 | } |
339 | catch (Exception ex) | 338 | catch (Exception ex) |
340 | { | 339 | { |
341 | m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Exception while trying to write script source to file \"" + srcFileName + "\": " + ex.ToString()); | 340 | m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: Exception while trying to write script source to file \"" + srcFileName + "\": " + ex.ToString()); |
342 | } | 341 | } |
343 | } | 342 | } |
344 | 343 | ||