From b4d128c811cd5b0344cc2cae1663e17f2951d183 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Mon, 12 May 2008 13:39:46 +0000 Subject: From: Alan M Webb This patch just tightens up console handling in BasOpenSimServer and removes (or redirects) a couple of messages that were being issued using Console.Writeline. --- OpenSim/Framework/Console/ConsoleBase.cs | 2 -- OpenSim/Framework/Servers/BaseOpenSimServer.cs | 29 ++++++++++++++++++++------ 2 files changed, 23 insertions(+), 8 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Console/ConsoleBase.cs b/OpenSim/Framework/Console/ConsoleBase.cs index b336545..79fe1d4 100644 --- a/OpenSim/Framework/Console/ConsoleBase.cs +++ b/OpenSim/Framework/Console/ConsoleBase.cs @@ -49,8 +49,6 @@ namespace OpenSim.Framework.Console m_componentName = componentname; m_cmdParser = cmdparser; - System.Console.WriteLine("Creating new local console"); - m_log.Info("[" + m_componentName + "]: Started at " + DateTime.Now.ToString()); } diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index af25ef4..b8ad83a 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -54,7 +54,10 @@ namespace OpenSim.Framework.Servers /// public virtual void Shutdown() { - m_console.Close(); + if(m_console != null) + { + m_console.Close(); + } Environment.Exit(0); } @@ -68,9 +71,9 @@ namespace OpenSim.Framework.Servers switch (command) { case "help": - m_console.Notice("quit - equivalent to shutdown."); - m_console.Notice("show uptime - show server startup and uptime."); - m_console.Notice("shutdown - shutdown the server.\n"); + Notice("quit - equivalent to shutdown."); + Notice("show uptime - show server startup and uptime."); + Notice("shutdown - shutdown the server.\n"); break; case "show": @@ -96,10 +99,24 @@ namespace OpenSim.Framework.Servers switch (ShowWhat) { case "uptime": - m_console.Notice("Server has been running since " + m_startuptime.ToString()); - m_console.Notice("That is " + (DateTime.Now - m_startuptime).ToString()); + Notice("Server has been running since " + m_startuptime.DayOfWeek + ", " + m_startuptime.ToString()); + Notice("That is an elapsed time of " + (DateTime.Now - m_startuptime).ToString()); break; } } + + /// + /// Console output is only possible if a console has been established. + /// That is something that cannot be determined within this class. So + /// all attempts to use the console MUST be verified. + /// + private void Notice(string msg) + { + if(m_console != null) + { + m_console.Notice(msg); + } + } + } } -- cgit v1.1