Remove the pre-log4net, discrete output methods from the consoles

0.6.6-post-fixes
Melanie Thielker 2009-05-20 13:50:33 +00:00
parent 4c7da1421f
commit 4065ebff15
17 changed files with 73 additions and 337 deletions

View File

@ -58,154 +58,6 @@ namespace OpenSim.Framework.Console
DefaultPrompt = defaultPrompt; DefaultPrompt = defaultPrompt;
} }
/// <summary>
/// derive an ansi color from a string, ignoring the darker colors.
/// This is used to help automatically bin component tags with colors
/// in various print functions.
/// </summary>
/// <param name="input">arbitrary string for input</param>
/// <returns>an ansii color</returns>
protected virtual ConsoleColor DeriveColor(string input)
{
return ConsoleColor.White;
}
/// <summary>
/// Sends a warning to the current console output
/// </summary>
/// <param name="format">The message to send</param>
/// <param name="args">WriteLine-style message arguments</param>
public void Warn(string format, params object[] args)
{
WriteNewLine(ConsoleColor.Yellow, format, args);
}
/// <summary>
/// Sends a warning to the current console output
/// </summary>
/// <param name="sender">The module that sent this message</param>
/// <param name="format">The message to send</param>
/// <param name="args">WriteLine-style message arguments</param>
public void Warn(string sender, string format, params object[] args)
{
WriteNewLine(DeriveColor(sender), sender, ConsoleColor.Yellow, format, args);
}
/// <summary>
/// Sends a notice to the current console output
/// </summary>
/// <param name="format">The message to send</param>
/// <param name="args">WriteLine-style message arguments</param>
public void Notice(string format, params object[] args)
{
WriteNewLine(ConsoleColor.White, format, args);
}
/// <summary>
/// Sends a notice to the current console output
/// </summary>
/// <param name="sender">The module that sent this message</param>
/// <param name="format">The message to send</param>
/// <param name="args">WriteLine-style message arguments</param>
public void Notice(string sender, string format, params object[] args)
{
WriteNewLine(DeriveColor(sender), sender, ConsoleColor.White, format, args);
}
/// <summary>
/// Sends an error to the current console output
/// </summary>
/// <param name="format">The message to send</param>
/// <param name="args">WriteLine-style message arguments</param>
public void Error(string format, params object[] args)
{
WriteNewLine(ConsoleColor.Red, format, args);
}
/// <summary>
/// Sends an error to the current console output
/// </summary>
/// <param name="sender">The module that sent this message</param>
/// <param name="format">The message to send</param>
/// <param name="args">WriteLine-style message arguments</param>
public void Error(string sender, string format, params object[] args)
{
WriteNewLine(DeriveColor(sender), sender, ConsoleColor.Red, format, args);
}
/// <summary>
/// Sends a status message to the current console output
/// </summary>
/// <param name="format">The message to send</param>
/// <param name="args">WriteLine-style message arguments</param>
public void Status(string format, params object[] args)
{
WriteNewLine(ConsoleColor.Blue, format, args);
}
/// <summary>
/// Sends a status message to the current console output
/// </summary>
/// <param name="sender">The module that sent this message</param>
/// <param name="format">The message to send</param>
/// <param name="args">WriteLine-style message arguments</param>
public void Status(string sender, string format, params object[] args)
{
WriteNewLine(DeriveColor(sender), sender, ConsoleColor.Blue, format, args);
}
[Conditional("DEBUG")]
public void Debug(string format, params object[] args)
{
WriteNewLine(ConsoleColor.Gray, format, args);
}
[Conditional("DEBUG")]
public void Debug(string sender, string format, params object[] args)
{
WriteNewLine(DeriveColor(sender), sender, ConsoleColor.Gray, format, args);
}
protected virtual void WriteNewLine(ConsoleColor senderColor, string sender, ConsoleColor color, string format, params object[] args)
{
WritePrefixLine(senderColor, sender);
WriteConsoleLine(color, format, args);
}
protected virtual void WriteNewLine(ConsoleColor color, string format, params object[] args)
{
WriteConsoleLine(color, format, args);
}
protected virtual void WriteConsoleLine(ConsoleColor color, string format, params object[] args)
{
try
{
System.Console.WriteLine(format, args);
}
catch (ObjectDisposedException)
{
}
}
protected virtual void WritePrefixLine(ConsoleColor color, string sender)
{
try
{
sender = sender.ToUpper();
System.Console.WriteLine("[" + sender + "] ");
System.Console.Write("[");
System.Console.Write(sender);
System.Console.Write("] \t");
}
catch (ObjectDisposedException)
{
}
}
public virtual void LockOutput() public virtual void LockOutput()
{ {
} }

View File

@ -124,7 +124,7 @@ namespace OpenSim.Framework.Console
/// </summary> /// </summary>
public void ShowHelp(ConsoleBase console) public void ShowHelp(ConsoleBase console)
{ {
console.Notice(String.Join(" ", m_cmdText) + " - " + m_helpText); console.Output(String.Join(" ", m_cmdText) + " - " + m_helpText);
} }
/// <summary> /// <summary>

View File

@ -62,19 +62,6 @@ namespace OpenSim.Framework.Console
history.Add(text); history.Add(text);
} }
/// <summary>
/// derive an ansi color from a string, ignoring the darker colors.
/// This is used to help automatically bin component tags with colors
/// in various print functions.
/// </summary>
/// <param name="input">arbitrary string for input</param>
/// <returns>an ansii color</returns>
protected override ConsoleColor DeriveColor(string input)
{
int colIdx = (input.ToUpper().GetHashCode() % 6) + 9;
return (ConsoleColor) colIdx;
}
private int SetCursorTop(int top) private int SetCursorTop(int top)
{ {
if (top >= 0 && top < System.Console.BufferHeight) if (top >= 0 && top < System.Console.BufferHeight)
@ -101,117 +88,6 @@ namespace OpenSim.Framework.Console
} }
} }
protected override void WriteNewLine(ConsoleColor senderColor, string sender, ConsoleColor color, string format, params object[] args)
{
lock (cmdline)
{
if (y != -1)
{
y=SetCursorTop(y);
System.Console.CursorLeft = 0;
int count = cmdline.Length;
System.Console.Write(" ");
while (count-- > 0)
System.Console.Write(" ");
y=SetCursorTop(y);
System.Console.CursorLeft = 0;
}
WritePrefixLine(senderColor, sender);
WriteConsoleLine(color, format, args);
if (y != -1)
y = System.Console.CursorTop;
}
}
protected override void WriteNewLine(ConsoleColor color, string format, params object[] args)
{
lock (cmdline)
{
if (y != -1)
{
y=SetCursorTop(y);
System.Console.CursorLeft = 0;
int count = cmdline.Length;
System.Console.Write(" ");
while (count-- > 0)
System.Console.Write(" ");
y=SetCursorTop(y);
System.Console.CursorLeft = 0;
}
WriteConsoleLine(color, format, args);
if (y != -1)
y = System.Console.CursorTop;
}
}
protected override void WriteConsoleLine(ConsoleColor color, string format, params object[] args)
{
try
{
lock (m_syncRoot)
{
try
{
if (color != ConsoleColor.White)
System.Console.ForegroundColor = color;
System.Console.WriteLine(format, args);
System.Console.ResetColor();
}
catch (ArgumentNullException)
{
// Some older systems dont support coloured text.
System.Console.WriteLine(format, args);
}
catch (FormatException)
{
System.Console.WriteLine(args);
}
}
}
catch (ObjectDisposedException)
{
}
}
protected override void WritePrefixLine(ConsoleColor color, string sender)
{
try
{
lock (m_syncRoot)
{
sender = sender.ToUpper();
System.Console.WriteLine("[" + sender + "] ");
System.Console.Write("[");
try
{
System.Console.ForegroundColor = color;
System.Console.Write(sender);
System.Console.ResetColor();
}
catch (ArgumentNullException)
{
// Some older systems dont support coloured text.
System.Console.WriteLine(sender);
}
System.Console.Write("] \t");
}
}
catch (ObjectDisposedException)
{
}
}
private void Show() private void Show()
{ {
lock (cmdline) lock (cmdline)

View File

@ -411,7 +411,7 @@ namespace OpenSim.Framework.Servers
{ {
if (m_console != null) if (m_console != null)
{ {
m_console.Notice(msg); m_console.Output(msg);
} }
} }

View File

@ -119,7 +119,7 @@ namespace OpenSim.Grid.AssetInventoryServer
public void Work() public void Work()
{ {
m_console.Notice("Enter help for a list of commands"); m_console.Output("Enter help for a list of commands");
while (true) while (true)
{ {

View File

@ -67,7 +67,7 @@ namespace OpenSim.Grid.AssetServer
private void Work() private void Work()
{ {
m_console.Notice("Enter help for a list of commands"); m_console.Output("Enter help for a list of commands");
while (true) while (true)
{ {

View File

@ -61,7 +61,7 @@ namespace OpenSim.Grid.GridServer
public void Work() public void Work()
{ {
m_console.Notice("Enter help for a list of commands\n"); m_console.Output("Enter help for a list of commands\n");
while (true) while (true)
{ {

View File

@ -164,7 +164,7 @@ namespace OpenSim.Grid.InventoryServer
private void Work() private void Work()
{ {
m_console.Notice("Enter help for a list of commands\n"); m_console.Output("Enter help for a list of commands\n");
while (true) while (true)
{ {

View File

@ -76,7 +76,7 @@ namespace OpenSim.Grid.MessagingServer
private void Work() private void Work()
{ {
m_console.Notice("Enter help for a list of commands\n"); m_console.Output("Enter help for a list of commands\n");
while (true) while (true)
{ {
@ -120,7 +120,7 @@ namespace OpenSim.Grid.MessagingServer
m_httpServer.Stop(); m_httpServer.Stop();
m_httpServer = null; m_httpServer = null;
} }
m_console.Notice("[SERVER]: Deregistered from userserver."); m_console.Output("[SERVER]: Deregistered from userserver.");
} }
protected override void StartupSpecific() protected override void StartupSpecific()
@ -192,7 +192,7 @@ namespace OpenSim.Grid.MessagingServer
private void HandleClearCache(string module, string[] cmd) private void HandleClearCache(string module, string[] cmd)
{ {
int entries = m_regionModule.ClearRegionCache(); int entries = m_regionModule.ClearRegionCache();
m_console.Notice("Region cache cleared! Cleared " + m_console.Output("Region cache cleared! Cleared " +
entries.ToString() + " entries"); entries.ToString() + " entries");
} }

View File

@ -91,7 +91,7 @@ namespace OpenSim.Grid.UserServer
public void Work() public void Work()
{ {
m_console.Notice("Enter help for a list of commands\n"); m_console.Output("Enter help for a list of commands\n");
while (true) while (true)
{ {
@ -280,7 +280,7 @@ namespace OpenSim.Grid.UserServer
public void TestResponse(List<InventoryFolderBase> resp) public void TestResponse(List<InventoryFolderBase> resp)
{ {
m_console.Notice("response got"); m_console.Output("response got");
} }
} }
} }

View File

@ -357,7 +357,7 @@ namespace OpenSim
if (presence.Firstname.ToLower().Contains(cmdparams[2].ToLower()) && if (presence.Firstname.ToLower().Contains(cmdparams[2].ToLower()) &&
presence.Lastname.ToLower().Contains(cmdparams[3].ToLower())) presence.Lastname.ToLower().Contains(cmdparams[3].ToLower()))
{ {
m_console.Notice( m_log.Info(
String.Format( String.Format(
"Kicking user: {0,-16}{1,-16}{2,-37} in region: {3,-16}", "Kicking user: {0,-16}{1,-16}{2,-37} in region: {3,-16}",
presence.Firstname, presence.Lastname, presence.UUID, regionInfo.RegionName)); presence.Firstname, presence.Lastname, presence.UUID, regionInfo.RegionName));
@ -372,7 +372,7 @@ namespace OpenSim
presence.Scene.IncomingCloseAgent(presence.UUID); presence.Scene.IncomingCloseAgent(presence.UUID);
} }
} }
m_console.Notice(""); m_log.Info("");
} }
/// <summary> /// <summary>
@ -418,7 +418,7 @@ namespace OpenSim
private void HandleForceUpdate(string module, string[] args) private void HandleForceUpdate(string module, string[] args)
{ {
m_console.Notice("Updating all clients"); m_log.Info("Updating all clients");
m_sceneManager.ForceCurrentSceneClientUpdate(); m_sceneManager.ForceCurrentSceneClientUpdate();
} }
@ -430,7 +430,7 @@ namespace OpenSim
} }
else else
{ {
m_console.Notice("Argument error: edit scale <prim name> <x> <y> <z>"); m_log.Info("Argument error: edit scale <prim name> <x> <y> <z>");
} }
} }
@ -438,7 +438,7 @@ namespace OpenSim
{ {
if (cmd.Length < 4 || !cmd[3].EndsWith(".xml")) if (cmd.Length < 4 || !cmd[3].EndsWith(".xml"))
{ {
m_console.Error("Usage: create region <region name> <region_file.xml>"); m_log.Error("Usage: create region <region name> <region_file.xml>");
return; return;
} }
@ -485,8 +485,8 @@ namespace OpenSim
case "set": case "set":
if (cmdparams.Length < 4) if (cmdparams.Length < 4)
{ {
m_console.Error(n, "SYNTAX: " + n + " SET SECTION KEY VALUE"); m_log.Error("SYNTAX: " + n + " SET SECTION KEY VALUE");
m_console.Error(n, "EXAMPLE: " + n + " SET ScriptEngine.DotNetEngine NumberOfScriptThreads 5"); m_log.Error("EXAMPLE: " + n + " SET ScriptEngine.DotNetEngine NumberOfScriptThreads 5");
} }
else else
{ {
@ -502,7 +502,7 @@ namespace OpenSim
c.Set(cmdparams[2], _value); c.Set(cmdparams[2], _value);
m_config.Source.Merge(source); m_config.Source.Merge(source);
m_console.Error(n, n + " " + n + " " + cmdparams[1] + " " + cmdparams[2] + " " + m_log.Error(n + " " + n + " " + cmdparams[1] + " " + cmdparams[2] + " " +
_value); _value);
} }
} }
@ -511,20 +511,20 @@ namespace OpenSim
case "get": case "get":
if (cmdparams.Length < 3) if (cmdparams.Length < 3)
{ {
m_console.Error(n, "SYNTAX: " + n + " GET SECTION KEY"); m_log.Error("SYNTAX: " + n + " GET SECTION KEY");
m_console.Error(n, "EXAMPLE: " + n + " GET ScriptEngine.DotNetEngine NumberOfScriptThreads"); m_log.Error("EXAMPLE: " + n + " GET ScriptEngine.DotNetEngine NumberOfScriptThreads");
} }
else else
{ {
IConfig c = m_config.Source.Configs[cmdparams[1]]; // DefaultConfig().Configs[cmdparams[1]]; IConfig c = m_config.Source.Configs[cmdparams[1]]; // DefaultConfig().Configs[cmdparams[1]];
if (c == null) if (c == null)
{ {
m_console.Notice(n, "Section \"" + cmdparams[1] + "\" does not exist."); m_log.Info("Section \"" + cmdparams[1] + "\" does not exist.");
break; break;
} }
else else
{ {
m_console.Notice(n + " GET " + cmdparams[1] + " " + cmdparams[2] + ": " + m_log.Info(n + " GET " + cmdparams[1] + " " + cmdparams[2] + ": " +
c.GetString(cmdparams[2])); c.GetString(cmdparams[2]));
} }
} }
@ -532,7 +532,7 @@ namespace OpenSim
break; break;
case "save": case "save":
m_console.Notice("Saving configuration file: " + Application.iniFilePath); m_log.Info("Saving configuration file: " + Application.iniFilePath);
m_config.Save(Application.iniFilePath); m_config.Save(Application.iniFilePath);
break; break;
} }
@ -552,7 +552,7 @@ namespace OpenSim
case "list": case "list":
foreach (IRegionModule irm in m_moduleLoader.GetLoadedSharedModules) foreach (IRegionModule irm in m_moduleLoader.GetLoadedSharedModules)
{ {
m_console.Notice("Shared region module: " + irm.Name); m_log.Info("Shared region module: " + irm.Name);
} }
break; break;
case "unload": case "unload":
@ -562,7 +562,7 @@ namespace OpenSim
{ {
if (rm.Name.ToLower() == cmdparams[1].ToLower()) if (rm.Name.ToLower() == cmdparams[1].ToLower())
{ {
m_console.Notice("Unloading module: " + rm.Name); m_log.Info("Unloading module: " + rm.Name);
m_moduleLoader.UnloadModule(rm); m_moduleLoader.UnloadModule(rm);
} }
} }
@ -573,7 +573,7 @@ namespace OpenSim
{ {
foreach (Scene s in new ArrayList(m_sceneManager.Scenes)) foreach (Scene s in new ArrayList(m_sceneManager.Scenes))
{ {
m_console.Notice("Loading module: " + cmdparams[1]); m_log.Info("Loading module: " + cmdparams[1]);
m_moduleLoader.LoadRegionModules(cmdparams[1], s); m_moduleLoader.LoadRegionModules(cmdparams[1], s);
} }
} }
@ -618,7 +618,7 @@ namespace OpenSim
if (m_sceneManager.TryGetScene(regRemoveName, out removeScene)) if (m_sceneManager.TryGetScene(regRemoveName, out removeScene))
RemoveRegion(removeScene, false); RemoveRegion(removeScene, false);
else else
m_console.Error("no region with that name"); m_log.Error("no region with that name");
break; break;
case "delete-region": case "delete-region":
@ -628,7 +628,7 @@ namespace OpenSim
if (m_sceneManager.TryGetScene(regDeleteName, out killScene)) if (m_sceneManager.TryGetScene(regDeleteName, out killScene))
RemoveRegion(killScene, true); RemoveRegion(killScene, true);
else else
m_console.Error("no region with that name"); m_log.Error("no region with that name");
break; break;
case "restart": case "restart":
@ -672,15 +672,15 @@ namespace OpenSim
string newRegionName = CombineParams(cmdparams, 2); string newRegionName = CombineParams(cmdparams, 2);
if (!m_sceneManager.TrySetCurrentScene(newRegionName)) if (!m_sceneManager.TrySetCurrentScene(newRegionName))
m_console.Error("Couldn't select region " + newRegionName); m_log.Error("Couldn't select region " + newRegionName);
} }
else else
{ {
m_console.Error("Usage: change region <region name>"); m_log.Error("Usage: change region <region name>");
} }
string regionName = (m_sceneManager.CurrentScene == null ? "root" : m_sceneManager.CurrentScene.RegionInfo.RegionName); string regionName = (m_sceneManager.CurrentScene == null ? "root" : m_sceneManager.CurrentScene.RegionInfo.RegionName);
m_console.Notice(String.Format("Currently selected region is {0}", regionName)); m_log.Info(String.Format("Currently selected region is {0}", regionName));
m_console.DefaultPrompt = String.Format("Region ({0}) ", regionName); m_console.DefaultPrompt = String.Format("Region ({0}) ", regionName);
m_console.ConsoleScene = m_sceneManager.CurrentScene; m_console.ConsoleScene = m_sceneManager.CurrentScene;
} }
@ -697,7 +697,7 @@ namespace OpenSim
} }
else else
{ {
m_console.Notice("Create user is not available in grid mode, use the user server."); m_log.Info("Create user is not available in grid mode, use the user server.");
} }
} }
@ -713,7 +713,7 @@ namespace OpenSim
} }
else else
{ {
m_console.Notice("Reset user password is not available in grid mode, use the user-server."); m_log.Info("Reset user password is not available in grid mode, use the user-server.");
} }
} }
@ -738,9 +738,9 @@ namespace OpenSim
} }
else else
{ {
m_console.Error("packet debug should be 0..255"); m_log.Error("packet debug should be 0..255");
} }
m_console.Notice("New packet debug: " + newDebug.ToString()); m_log.Info("New packet debug: " + newDebug.ToString());
} }
break; break;
@ -750,7 +750,7 @@ namespace OpenSim
{ {
if (m_sceneManager.CurrentScene == null) if (m_sceneManager.CurrentScene == null)
{ {
m_console.Notice("Please use 'change region <regioname>' first"); m_log.Info("Please use 'change region <regioname>' first");
} }
else else
{ {
@ -759,8 +759,7 @@ namespace OpenSim
bool physicsOn = !Convert.ToBoolean(args[4]); bool physicsOn = !Convert.ToBoolean(args[4]);
m_sceneManager.CurrentScene.SetSceneCoreDebug(scriptingOn, collisionsOn, physicsOn); m_sceneManager.CurrentScene.SetSceneCoreDebug(scriptingOn, collisionsOn, physicsOn);
m_console.Notice( m_log.Info(
"CONSOLE",
String.Format( String.Format(
"Set debug scene scripting = {0}, collisions = {1}, physics = {2}", "Set debug scene scripting = {0}, collisions = {1}, physics = {2}",
!scriptingOn, !collisionsOn, !physicsOn)); !scriptingOn, !collisionsOn, !physicsOn));
@ -768,13 +767,13 @@ namespace OpenSim
} }
else else
{ {
m_console.Error("debug scene <scripting> <collisions> <physics> (where inside <> is true/false)"); m_log.Error("debug scene <scripting> <collisions> <physics> (where inside <> is true/false)");
} }
break; break;
default: default:
m_console.Error("Unknown debug"); m_log.Error("Unknown debug");
break; break;
} }
} }
@ -805,9 +804,9 @@ namespace OpenSim
agents = m_sceneManager.GetCurrentSceneAvatars(); agents = m_sceneManager.GetCurrentSceneAvatars();
} }
m_console.Notice(String.Format("\nAgents connected: {0}\n", agents.Count)); m_log.Info(String.Format("\nAgents connected: {0}\n", agents.Count));
m_console.Notice( m_log.Info(
String.Format("{0,-16}{1,-16}{2,-37}{3,-11}{4,-16}", "Firstname", "Lastname", String.Format("{0,-16}{1,-16}{2,-37}{3,-11}{4,-16}", "Firstname", "Lastname",
"Agent ID", "Root/Child", "Region")); "Agent ID", "Root/Child", "Region"));
@ -825,7 +824,7 @@ namespace OpenSim
regionName = regionInfo.RegionName; regionName = regionInfo.RegionName;
} }
m_console.Notice( m_log.Info(
String.Format( String.Format(
"{0,-16}{1,-16}{2,-37}{3,-11}{4,-16}", "{0,-16}{1,-16}{2,-37}{3,-11}{4,-16}",
presence.Firstname, presence.Firstname,
@ -835,14 +834,14 @@ namespace OpenSim
regionName)); regionName));
} }
m_console.Notice(""); m_log.Info("");
break; break;
case "modules": case "modules":
m_console.Notice("The currently loaded shared modules are:"); m_log.Info("The currently loaded shared modules are:");
foreach (IRegionModule module in m_moduleLoader.GetLoadedSharedModules) foreach (IRegionModule module in m_moduleLoader.GetLoadedSharedModules)
{ {
m_console.Notice("Shared Module: " + module.Name); m_log.Info("Shared Module: " + module.Name);
} }
break; break;
@ -850,7 +849,7 @@ namespace OpenSim
m_sceneManager.ForEachScene( m_sceneManager.ForEachScene(
delegate(Scene scene) delegate(Scene scene)
{ {
m_console.Notice("Region Name: " + scene.RegionInfo.RegionName + " , Region XLoc: " + m_log.Info("Region Name: " + scene.RegionInfo.RegionName + " , Region XLoc: " +
scene.RegionInfo.RegionLocX + " , Region YLoc: " + scene.RegionInfo.RegionLocX + " , Region YLoc: " +
scene.RegionInfo.RegionLocY + " , Region Port: " + scene.RegionInfo.RegionLocY + " , Region Port: " +
scene.RegionInfo.InternalEndPoint.Port.ToString()); scene.RegionInfo.InternalEndPoint.Port.ToString());
@ -878,7 +877,7 @@ namespace OpenSim
{ {
rating = "PG"; rating = "PG";
} }
m_console.Notice("Region Name: " + scene.RegionInfo.RegionName + " , Region Rating: " + m_log.Info("Region Name: " + scene.RegionInfo.RegionName + " , Region Rating: " +
rating); rating);
}); });
break; break;
@ -1044,7 +1043,7 @@ namespace OpenSim
{ {
loadOffset.Z = (float) Convert.ToDecimal(cmdparams[6]); loadOffset.Z = (float) Convert.ToDecimal(cmdparams[6]);
} }
m_console.Error("loadOffsets <X,Y,Z> = <" + loadOffset.X + "," + loadOffset.Y + "," + m_log.Error("loadOffsets <X,Y,Z> = <" + loadOffset.X + "," + loadOffset.Y + "," +
loadOffset.Z + ">"); loadOffset.Z + ">");
} }
} }
@ -1058,7 +1057,7 @@ namespace OpenSim
} }
catch (FileNotFoundException) catch (FileNotFoundException)
{ {
m_console.Error("Default xml not found. Usage: load-xml <filename>"); m_log.Error("Default xml not found. Usage: load-xml <filename>");
} }
} }
} }
@ -1085,7 +1084,7 @@ namespace OpenSim
} }
catch (FileNotFoundException) catch (FileNotFoundException)
{ {
m_console.Error("Specified xml not found. Usage: load xml2 <filename>"); m_log.Error("Specified xml not found. Usage: load xml2 <filename>");
} }
} }
else else
@ -1096,7 +1095,7 @@ namespace OpenSim
} }
catch (FileNotFoundException) catch (FileNotFoundException)
{ {
m_console.Error("Default xml not found. Usage: load xml2 <filename>"); m_log.Error("Default xml not found. Usage: load xml2 <filename>");
} }
} }
} }
@ -1120,7 +1119,7 @@ namespace OpenSim
} }
catch (Exception e) catch (Exception e)
{ {
m_console.Error(e.Message); m_log.Error(e.Message);
} }
} }

View File

@ -273,7 +273,7 @@ namespace OpenSim
// //
ICommander moduleCommander = SceneManager.CurrentOrFirstScene.GetCommander(cmd[1]); ICommander moduleCommander = SceneManager.CurrentOrFirstScene.GetCommander(cmd[1]);
if (moduleCommander != null) if (moduleCommander != null)
m_console.Notice(moduleCommander.Help); m_console.Output(moduleCommander.Help);
} }
protected override void Initialize() protected override void Initialize()

View File

@ -76,6 +76,10 @@ namespace OpenSim.Server.Base
} }
m_HttpServer = new BaseHttpServer(port); m_HttpServer = new BaseHttpServer(port);
if (MainConsole.Instance is RemoteConsole)
{
((RemoteConsole)MainConsole.Instance).SetServer(m_HttpServer);
}
} }
protected override void Initialise() protected override void Initialise()

View File

@ -145,6 +145,11 @@ namespace OpenSim.Server.Base
{ {
MainConsole.Instance = new CommandConsole(prompt); MainConsole.Instance = new CommandConsole(prompt);
} }
else if (consoleType == "rest")
{
MainConsole.Instance = new RemoteConsole(prompt);
((RemoteConsole)MainConsole.Instance).ReadConfig(Config);
}
else else
{ {
MainConsole.Instance = new LocalConsole(prompt); MainConsole.Instance = new LocalConsole(prompt);

View File

@ -147,7 +147,7 @@ namespace OpenSim.TestSuite
} }
else else
{ {
MainConsole.Instance.Error(firstname + " " + lastname, "Can't login: " + client.Network.LoginMessage); MainConsole.Instance.Output(firstname + " " + lastname + "Can't login: " + client.Network.LoginMessage);
if (OnDisconnected != null) if (OnDisconnected != null)
{ {
OnDisconnected(this, EventType.DISCONNECTED); OnDisconnected(this, EventType.DISCONNECTED);

View File

@ -213,7 +213,7 @@ namespace pCampBot
private void HandleShutdown(string module, string[] cmd) private void HandleShutdown(string module, string[] cmd)
{ {
m_console.Warn("BOTMANAGER", "Shutting down bots"); m_log.Warn("[BOTMANAGER]: Shutting down bots");
doBotShutdown(); doBotShutdown();
} }

View File

@ -180,7 +180,7 @@ namespace pCampBot
} }
else else
{ {
MainConsole.Instance.Error(firstname + " " + lastname, "Can't login: " + client.Network.LoginMessage); MainConsole.Instance.Output(firstname + " " + lastname + " Can't login: " + client.Network.LoginMessage);
if (OnDisconnected != null) if (OnDisconnected != null)
{ {
OnDisconnected(this, EventType.DISCONNECTED); OnDisconnected(this, EventType.DISCONNECTED);
@ -222,12 +222,12 @@ namespace pCampBot
} }
else else
{ {
MainConsole.Instance.Error(String.Format("Failed to decode {0} asset {1}", asset.AssetType, asset.AssetID)); MainConsole.Instance.Output(String.Format("Failed to decode {0} asset {1}", asset.AssetType, asset.AssetID));
} }
} }
catch (Exception e) catch (Exception e)
{ {
MainConsole.Instance.Error(String.Format("Exception: {0}",e.ToString())); MainConsole.Instance.Output(String.Format("Exception: {0}",e.ToString()));
} }
} }
} }
@ -261,7 +261,7 @@ namespace pCampBot
if (wear == "yes") if (wear == "yes")
{ {
//TODO: Implement random outfit picking //TODO: Implement random outfit picking
MainConsole.Instance.Notice("Picks a random outfit. Not yet implemented."); MainConsole.Instance.Output("Picks a random outfit. Not yet implemented.");
} }
else if (wear != "save") else if (wear != "save")
saveDir = "MyAppearance/" + wear; saveDir = "MyAppearance/" + wear;
@ -290,7 +290,7 @@ namespace pCampBot
listwearables.Add(item); listwearables.Add(item);
} }
else else
MainConsole.Instance.Error(String.Format("Failed to create item {0}",item.Name)); MainConsole.Instance.Output(String.Format("Failed to create item {0}",item.Name));
} }
); );
} }
@ -312,7 +312,7 @@ namespace pCampBot
listwearables.Add(item); listwearables.Add(item);
} }
else else
MainConsole.Instance.Error(String.Format("Failed to create item {0}",item.Name)); MainConsole.Instance.Output(String.Format("Failed to create item {0}",item.Name));
} }
); );
} }
@ -320,10 +320,10 @@ namespace pCampBot
Thread.Sleep(1000); Thread.Sleep(1000);
if (listwearables == null || listwearables.Count == 0) if (listwearables == null || listwearables.Count == 0)
MainConsole.Instance.Notice("Nothing to send on this folder!"); MainConsole.Instance.Output("Nothing to send on this folder!");
else else
{ {
MainConsole.Instance.Notice(String.Format("Sending {0} wearables...",listwearables.Count)); MainConsole.Instance.Output(String.Format("Sending {0} wearables...",listwearables.Count));
client.Appearance.WearOutfit(listwearables, false); client.Appearance.WearOutfit(listwearables, false);
} }
} }