|
@@ -35,6 +35,32 @@ using log4net;
|
|
|
|
|
|
namespace OpenSim.Framework.Console
|
|
|
{
|
|
|
+ public class ConsoleLevel
|
|
|
+ {
|
|
|
+ public string m_string;
|
|
|
+
|
|
|
+ ConsoleLevel(string v)
|
|
|
+ {
|
|
|
+ m_string = v;
|
|
|
+ }
|
|
|
+
|
|
|
+ static public implicit operator ConsoleLevel(string s)
|
|
|
+ {
|
|
|
+ return new ConsoleLevel(s);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static string ToString(ConsoleLevel s)
|
|
|
+ {
|
|
|
+ return s.m_string;
|
|
|
+ }
|
|
|
+
|
|
|
+ public override string ToString()
|
|
|
+ {
|
|
|
+ return m_string;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
public class ConsoleBase : IConsole
|
|
|
{
|
|
|
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
|
@@ -58,14 +84,39 @@ namespace OpenSim.Framework.Console
|
|
|
{
|
|
|
}
|
|
|
|
|
|
- public void Output(string format, params object[] components)
|
|
|
+ public void Output(string format)
|
|
|
{
|
|
|
- Output(format, null, components);
|
|
|
+ System.Console.WriteLine(format);
|
|
|
}
|
|
|
|
|
|
- public virtual void Output(string format, string level, params object[] components)
|
|
|
+ public virtual void Output(string format, params object[] components)
|
|
|
{
|
|
|
- System.Console.WriteLine(format, components);
|
|
|
+ string level = null;
|
|
|
+ if (components != null && components.Length > 0)
|
|
|
+ {
|
|
|
+ if (components[0] == null || components[0] is ConsoleLevel)
|
|
|
+ {
|
|
|
+ if (components[0] is ConsoleLevel)
|
|
|
+ level = ((ConsoleLevel)components[0]).ToString();
|
|
|
+
|
|
|
+ if (components.Length > 1)
|
|
|
+ {
|
|
|
+ object[] tmp = new object[components.Length - 1];
|
|
|
+ Array.Copy(components, 1, tmp, 0, components.Length - 1);
|
|
|
+ components = tmp;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ components = null;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ string text;
|
|
|
+ if (components == null || components.Length == 0)
|
|
|
+ text = format;
|
|
|
+ else
|
|
|
+ text = String.Format(format, components);
|
|
|
+
|
|
|
+ System.Console.WriteLine(text);
|
|
|
}
|
|
|
|
|
|
public string Prompt(string p)
|