aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Console
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Console')
-rwxr-xr-xOpenSim/Framework/Console/ConsoleBase.cs59
-rwxr-xr-xOpenSim/Framework/Console/LocalConsole.cs27
-rwxr-xr-xOpenSim/Framework/Console/MockConsole.cs2
-rw-r--r--OpenSim/Framework/Console/OpenSimAppender.cs4
-rwxr-xr-xOpenSim/Framework/Console/RemoteConsole.cs30
5 files changed, 110 insertions, 12 deletions
diff --git a/OpenSim/Framework/Console/ConsoleBase.cs b/OpenSim/Framework/Console/ConsoleBase.cs
index 343958b..f9dfb63 100755
--- a/OpenSim/Framework/Console/ConsoleBase.cs
+++ b/OpenSim/Framework/Console/ConsoleBase.cs
@@ -35,6 +35,32 @@ using log4net;
35 35
36namespace OpenSim.Framework.Console 36namespace OpenSim.Framework.Console
37{ 37{
38 public class ConsoleLevel
39 {
40 public string m_string;
41
42 ConsoleLevel(string v)
43 {
44 m_string = v;
45 }
46
47 static public implicit operator ConsoleLevel(string s)
48 {
49 return new ConsoleLevel(s);
50 }
51
52 public static string ToString(ConsoleLevel s)
53 {
54 return s.m_string;
55 }
56
57 public override string ToString()
58 {
59 return m_string;
60 }
61 }
62
63
38 public class ConsoleBase : IConsole 64 public class ConsoleBase : IConsole
39 { 65 {
40// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 66// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -58,14 +84,39 @@ namespace OpenSim.Framework.Console
58 { 84 {
59 } 85 }
60 86
61 public void Output(string format, params object[] components) 87 public void Output(string format)
62 { 88 {
63 Output(format, null, components); 89 System.Console.WriteLine(format);
64 } 90 }
65 91
66 public virtual void Output(string format, string level, params object[] components) 92 public virtual void Output(string format, params object[] components)
67 { 93 {
68 System.Console.WriteLine(format, components); 94 string level = null;
95 if (components != null && components.Length > 0)
96 {
97 if (components[0] == null || components[0] is ConsoleLevel)
98 {
99 if (components[0] is ConsoleLevel)
100 level = ((ConsoleLevel)components[0]).ToString();
101
102 if (components.Length > 1)
103 {
104 object[] tmp = new object[components.Length - 1];
105 Array.Copy(components, 1, tmp, 0, components.Length - 1);
106 components = tmp;
107 }
108 else
109 components = null;
110 }
111
112 }
113 string text;
114 if (components == null || components.Length == 0)
115 text = format;
116 else
117 text = String.Format(format, components);
118
119 System.Console.WriteLine(text);
69 } 120 }
70 121
71 public string Prompt(string p) 122 public string Prompt(string p)
diff --git a/OpenSim/Framework/Console/LocalConsole.cs b/OpenSim/Framework/Console/LocalConsole.cs
index d19e244..e1492b8 100755
--- a/OpenSim/Framework/Console/LocalConsole.cs
+++ b/OpenSim/Framework/Console/LocalConsole.cs
@@ -389,9 +389,32 @@ namespace OpenSim.Framework.Console
389 System.Console.WriteLine(); 389 System.Console.WriteLine();
390 } 390 }
391 391
392 public override void Output(string format, string level, params object[] components) 392 public override void Output(string format, params object[] components)
393 { 393 {
394 string text = String.Format(format, components); 394 string level = null;
395 if(components != null && components.Length > 0)
396 {
397 if(components[0] == null || components[0] is ConsoleLevel)
398 {
399 if(components[0] is ConsoleLevel)
400 level = ((ConsoleLevel)components[0]).ToString();
401
402 if (components.Length > 1)
403 {
404 object[] tmp = new object[components.Length - 1];
405 Array.Copy(components, 1, tmp, 0, components.Length - 1);
406 components = tmp;
407 }
408 else
409 components = null;
410 }
411
412 }
413 string text;
414 if (components == null || components.Length == 0)
415 text = format;
416 else
417 text = String.Format(format, components);
395 418
396 FireOnOutput(text); 419 FireOnOutput(text);
397 420
diff --git a/OpenSim/Framework/Console/MockConsole.cs b/OpenSim/Framework/Console/MockConsole.cs
index 291b7e9..d314047 100755
--- a/OpenSim/Framework/Console/MockConsole.cs
+++ b/OpenSim/Framework/Console/MockConsole.cs
@@ -62,8 +62,8 @@ namespace OpenSim.Framework.Console
62 set {} 62 set {}
63 } 63 }
64 64
65 public void Output(string format) { }
65 public void Output(string format, params object[] components) { } 66 public void Output(string format, params object[] components) { }
66 public void Output(string format, string level, params object[] components) { }
67 67
68 public string Prompt(string p) { return ""; } 68 public string Prompt(string p) { return ""; }
69 public string Prompt(string p, string def) { return ""; } 69 public string Prompt(string p, string def) { return ""; }
diff --git a/OpenSim/Framework/Console/OpenSimAppender.cs b/OpenSim/Framework/Console/OpenSimAppender.cs
index 72a251e..39a550b 100644
--- a/OpenSim/Framework/Console/OpenSimAppender.cs
+++ b/OpenSim/Framework/Console/OpenSimAppender.cs
@@ -55,12 +55,14 @@ namespace OpenSim.Framework.Console
55 { 55 {
56 if (m_console != null) 56 if (m_console != null)
57 { 57 {
58 string level = "normal"; 58 ConsoleLevel level;
59 59
60 if (le.Level == Level.Error) 60 if (le.Level == Level.Error)
61 level = "error"; 61 level = "error";
62 else if (le.Level == Level.Warn) 62 else if (le.Level == Level.Warn)
63 level = "warn"; 63 level = "warn";
64 else
65 level = "normal";
64 66
65 m_console.Output(loggingMessage, level); 67 m_console.Output(loggingMessage, level);
66 } 68 }
diff --git a/OpenSim/Framework/Console/RemoteConsole.cs b/OpenSim/Framework/Console/RemoteConsole.cs
index 8dc7333..889df36 100755
--- a/OpenSim/Framework/Console/RemoteConsole.cs
+++ b/OpenSim/Framework/Console/RemoteConsole.cs
@@ -190,12 +190,34 @@ namespace OpenSim.Framework.Console
190 m_Server.AddHTTPHandler("/SessionCommand/", HandleHttpSessionCommand); 190 m_Server.AddHTTPHandler("/SessionCommand/", HandleHttpSessionCommand);
191 } 191 }
192 192
193 public override void Output(string format, string level = null, params object[] components) 193 public override void Output(string format, params object[] components)
194 { 194 {
195 if (components.Length == 0) 195 string level = null;
196 Output(format, level, false, false, false); 196 if (components != null && components.Length > 0)
197 {
198 if (components[0] == null || components[0] is ConsoleLevel)
199 {
200 if (components[0] is ConsoleLevel)
201 level = ((ConsoleLevel)components[0]).ToString();
202
203 if (components.Length > 1)
204 {
205 object[] tmp = new object[components.Length - 1];
206 Array.Copy(components, 1, tmp, 0, components.Length - 1);
207 components = tmp;
208 }
209 else
210 components = null;
211 }
212 }
213
214 string text;
215 if (components == null || components.Length == 0)
216 text = format;
197 else 217 else
198 Output(String.Format(format, components), level, false, false, false); 218 text = String.Format(format, components);
219
220 Output(text, level, false, false, false);
199 } 221 }
200 222
201 protected void Output(string text, string level, bool isPrompt, bool isCommand, bool isInput) 223 protected void Output(string text, string level, bool isPrompt, bool isCommand, bool isInput)