dotgnu-pnet
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pnet-developers] Debug, Listeners, DefaultTraceListener


From: Marcus
Subject: [Pnet-developers] Debug, Listeners, DefaultTraceListener
Date: Sun, 14 Nov 2004 00:34:21 -0600
User-agent: KMail/1.7.1

For some reason, the DefaultTraceListener in Pnet always write to standard 
error (or standard output, depending on the CONFIG_SMALL setting). This is 
different from the .NET behavior where something along the lines of 

Debug.Listeners.Add(new TextWriterTraceListener(Console.Out));

must be used. The result is that when the above statement is used so that .NET 
and Mono will print debugging information, Pnet prints it twice, making the 
output hard to read.

I thought that I had discussed this with Rhys a while back, but I do not 
remember what happens to it. The solution appears to be deleting a few lines 
from DefaultTraceListener.cs:

 public override void Write(String message)
   {
    lock(this)
    {
     if(NeedIndent)
     {
      WriteIndent();
     }
// DELETE ME
//     #if CONFIG_SMALL_CONSOLE
//      Console.Write(message);
//     #else
//      Console.Error.Write(message);
//     #endif
     WriteLog(message, false);
    }
   }

 // Write data to this trace listener's output stream followed by newline.
 public override void WriteLine(String message)
   {
    lock(this)
    {
     if(NeedIndent)
     {
      WriteIndent();
     }
// DELETE ME
//     #if CONFIG_SMALL_CONSOLE
//      Console.WriteLine(message);
//     #else
//      Console.Error.WriteLine(message);
//     #endif
     WriteLog(message, true);
     NeedIndent = true;
    }
   }

Could someone take a look at this?

Marcus


reply via email to

[Prev in Thread] Current Thread [Next in Thread]