> I think that is a great idea. It should be as simple as post-processing > the output stream and pre-pending the (indent) spaces at the front of each > line. It might be easier to create an PrependedStringReader that take a > string to pre-pend to each line, and the stream to read from. Then we can > just use that everywhere else :) > This sounds like a job for the System.Diagnostics Trace and TraceListener. It supports indenting, named output, pluggable listeners and config files. Something like this...
import System.IO; import System.Diagnostics; void Setup() { Console.SetOut(new TraceTextWriter()); Trace.Listeners.Add(new TextWriterTraceListener(Console.Out)); // NOTE: XmlTraceListener doesn't exist yet Trace.Listeners.Add(new XmlTraceListener("logfile.xml")); } void Example() { Trace.WriteLine("target-name", "target"); Trace.Indent(); Trace.WriteLine("some output", "taskname"); Trace.Indent(); Console.WriteLine("output from tool"); Trace.Unindent(); Trace.WriteLine("some more output", "taskname"); Trace.Unindent(); } class TraceTextWriter : TextWriter { override public void WriteLine(string text) { Trace.WriteLine(text); } } I've been using this stuff recently in a unit test runner I've been writing for Visual Studio.NET. Thinking about it this component could be made into a task for NAnt. At the moment it supports all 2.x versions of NUnit, JUnit and I'm thinking of adding support for #Unit. Is anyone using #Unit? What do you reckon? Jamie. -- NUnitAddin - Point and Test NUnit integration for Visual Studio.NET http://dotnetweblogs.com/nunitaddin/ http://sourceforge.net/projects/nunitaddin/ ----- Original Message ----- From: "Matthew Mastracci" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, February 13, 2003 8:46 PM Subject: [nant-dev] Indenting external program output? > Should the external program tasks indent the output from their > respective programs? I find it difficult to read parts of the NAnt log > where the program output is jammed to the left margin. I think it would > be easier to associate the output if it was indented an extra level > beneath the task itself. > > Perhaps an option on the externaltaskbase that controls indenting of > program output? > > [csc] Compiling 32 files to > C:\Temp\nant2\nant\build\nant-0.8.0-debug\bin\ > NAnt.Core.Tests.dll > [csc] Compiling 2 files to > C:\Temp\nant2\nant\build\nant-0.8.0-debug\bin\N > Ant.exe > C:\Temp\nant2\nant\src\NAnt.Console\ConsoleStub.cs(60,17): warning > CS0168: The v > ariable 'e' is declared but never used > C:\Temp\nant2\nant\src\NAnt.Console\ConsoleStub.cs(97,21): warning > CS0168: The v > ariable 'fnf' is declared but never used > > [copy] Copying 1 files > [csc] Compiling 1 files to > C:\Temp\nant2\nant\build\nant-0.8.0-debug\bin\N > Ant.Console.Tests.dll > [nant] src/NAnt.DotNetTasks.build build > Buildfile: > file:///C:/Temp/nant2/nant/src/NAnt.DotNetTasks.build > > > > ------------------------------------------------------- > This SF.NET email is sponsored by: FREE SSL Guide from Thawte > are you planning your Web Server Security? Click here to get a FREE > Thawte SSL guide and find the answers to all your SSL security issues. > http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en > _______________________________________________ > Nant-developers mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/nant-developers > > ------------------------------------------------------- This SF.NET email is sponsored by: FREE SSL Guide from Thawte are you planning your Web Server Security? Click here to get a FREE Thawte SSL guide and find the answers to all your SSL security issues. http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en _______________________________________________ Nant-developers mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-developers ------------------------------------------------------- This SF.NET email is sponsored by: FREE SSL Guide from Thawte are you planning your Web Server Security? Click here to get a FREE Thawte SSL guide and find the answers to all your SSL security issues. http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en _______________________________________________ Nant-developers mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-developers