* Fixing the console write on shutdown where the object is already disposed.
parent
ffb6198380
commit
ba142c0410
|
@ -232,68 +232,85 @@ namespace OpenSim.Framework.Console
|
||||||
|
|
||||||
private void WriteNewLine(ConsoleColor color, string format, params object[] args)
|
private void WriteNewLine(ConsoleColor color, string format, params object[] args)
|
||||||
{
|
{
|
||||||
lock (m_syncRoot)
|
try
|
||||||
{
|
{
|
||||||
string now = DateTime.Now.ToString("[MM-dd HH:mm:ss] ");
|
lock (m_syncRoot)
|
||||||
Log.Write(now);
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
Log.WriteLine(format, args);
|
string now = DateTime.Now.ToString("[MM-dd HH:mm:ss] ");
|
||||||
Log.Flush();
|
Log.Write(now);
|
||||||
}
|
try
|
||||||
|
{
|
||||||
|
Log.WriteLine(format, args);
|
||||||
|
Log.Flush();
|
||||||
|
}
|
||||||
|
|
||||||
catch (FormatException)
|
catch (FormatException)
|
||||||
{
|
{
|
||||||
System.Console.WriteLine(args);
|
System.Console.WriteLine(args);
|
||||||
}
|
}
|
||||||
System.Console.Write(now);
|
System.Console.Write(now);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (color != ConsoleColor.White)
|
if (color != ConsoleColor.White)
|
||||||
System.Console.ForegroundColor = color;
|
System.Console.ForegroundColor = color;
|
||||||
|
|
||||||
System.Console.WriteLine(format, args);
|
System.Console.WriteLine(format, args);
|
||||||
System.Console.ResetColor();
|
System.Console.ResetColor();
|
||||||
}
|
}
|
||||||
catch (ArgumentNullException)
|
catch (ArgumentNullException)
|
||||||
{
|
{
|
||||||
// Some older systems dont support coloured text.
|
// Some older systems dont support coloured text.
|
||||||
System.Console.WriteLine(format, args);
|
System.Console.WriteLine(format, args);
|
||||||
}
|
}
|
||||||
catch (FormatException)
|
catch (FormatException)
|
||||||
{
|
{
|
||||||
// Some older systems dont support coloured text.
|
// Some older systems dont support coloured text.
|
||||||
System.Console.WriteLine(args);
|
System.Console.WriteLine(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (ObjectDisposedException)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WritePrefixLine(ConsoleColor color, string sender)
|
private void WritePrefixLine(ConsoleColor color, string sender)
|
||||||
{
|
{
|
||||||
lock (m_syncRoot)
|
try
|
||||||
{
|
{
|
||||||
sender = sender.ToUpper();
|
lock (m_syncRoot)
|
||||||
Log.WriteLine("[" + sender + "] ");
|
|
||||||
Log.Flush();
|
|
||||||
|
|
||||||
System.Console.Write("[");
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
System.Console.ForegroundColor = color;
|
sender = sender.ToUpper();
|
||||||
System.Console.Write(sender);
|
|
||||||
System.Console.ResetColor();
|
|
||||||
}
|
|
||||||
catch (ArgumentNullException)
|
|
||||||
{
|
|
||||||
// Some older systems dont support coloured text.
|
|
||||||
System.Console.WriteLine(sender);
|
|
||||||
}
|
|
||||||
|
|
||||||
System.Console.Write("] \t");
|
Log.WriteLine("[" + sender + "] ");
|
||||||
|
|
||||||
|
|
||||||
|
Log.Flush();
|
||||||
|
|
||||||
|
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");
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (ObjectDisposedException)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue