Hi Bob,

 

This is only done when logging from a task.

You could do something like this (although I agree it's a hack):

 

<project name="script-test" default="build">

    <target name="build">

        <script language="C#">

            <code>

                <![CDATA[

                    public static void ScriptMain (Project project)

                    {

                        Log (project, "ok");

                    }

                        

                    private static void Log (Project project, string
message)

                    {

                        Task task = new LogTask ();

                        task.Project = project;

                        task.Log (Level.Info, message);

                    }

                              

                    [TaskName ("whatever")]

                    public class LogTask : Task

                    {

                        protected override void ExecuteTask ()

                        {

                        }

                    }

                ]]>

            </code>

        </script>

    </target>

</project>

 

Hope this helps,

 

Gert

 

From: Bob Archer [mailto:bob.arc...@amsi.com] 
Sent: woensdag 13 mei 2009 21:22
To: nant-users@lists.sourceforge.net
Subject: [NAnt-users] script task

 

Ok,

 

I am trying to log from code in a script task. I use code such as this:

 

            project.Log(Level.Info, "I am in the script function.");

 

But the console log looks like this:

 

   [script] Scanning assembly "tommx7ja" for extensions.

I am in the script function.

 

What is it not formatted the same? Do I have to specify a certain logger or
something?

 

BOb

 

Internal Virus Database is out of date.
Checked by AVG - www.avg.com
Version: 8.5.285 / Virus Database: 270.12.2/2072 - Release Date: 04/21/09
16:48:00

------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to