Hi all,

I found some time to look into verbosity in NAnt. I think verbose=true /
false is not sufficient control in task level. In project level you
have -debug, -quiet and normal run.

What I do in this patch, is add new attribute at element level (so enable
use it for all tasks and types) names "verbosity". So code like this is now
possible:
  <xmlpeek refid="x1" xpath="book/author/name" property="authorname"
verbosity="Error"/>
or
  <exec program="foo.exe" commandline="1 2 3" failonerror="false"
vebosity="Debug"/>

First one suppress any message except errors, second one does opposite -
turns on all messages. When no verbosity is specified, default is taken from
project setting - so you override -debug or -quiet option for this specific
task.

Next use we could have from this is better control over logging when use
task embedded in another task/function. E.g. <csc> or <resgen> from
<solution> or <xmlpeek> task from xml::peek function:
        [Function("peek")]
        public string XmlPeek(string refid,string xpath) {
            XmlPeekTask peek = new XmlPeekTask();
            peek.Verbosity = Level.Warning;
            ...
        }


I hope you will like it. All old behaviours (log4net loggers, verbose
attribute) should work as they did before. I was also careful to do not miss
to comment, properly format code etc.

One note: It is important to use Element.Log() not Project.Log() in all
tasks.

Regards,
Martin

btw: I dont like much how thresholds are done. Also two loggers (log.cs /
log4net) seems to be redundant. What about to use log4net even for common
user log messages? Why to use it only for internals. log4net could be used
very nicely even for user output - log to file+screen, message formatting,
cyclic logs etc etc etc...

Attachment: element.cs.patch
Description: Binary data

Attachment: log.cs.patch
Description: Binary data

Attachment: project.cs.patch
Description: Binary data

Attachment: task.cs.patch
Description: Binary data

Reply via email to