diff options
Diffstat (limited to '')
-rwxr-xr-x | OpenSim/Framework/Console/ConsoleBase.cs | 59 |
1 files changed, 55 insertions, 4 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 | ||
36 | namespace OpenSim.Framework.Console | 36 | namespace 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) |