ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Christen" <...@active.ch>
Subject AW: [PATCH] Wait and Available (Updated)
Date Sat, 13 Jan 2001 14:52:45 GMT


> -----Urspr√ľngliche Nachricht-----
> Von: Steve Loughran [mailto:steve_l@iseran.com]
> Gesendet am: Freitag, 12. Januar 2001 23:41
> An: ant-dev@jakarta.apache.org
> Betreff: Re: [PATCH] Wait and Available (Updated)
> You know, I've been thinking for a while about the feasibility of teasing
> out the logging methods into a separate interface.
So was I

> If there was a separate interface for logging (called say Logger)
Well I did it a bit different. I was thinking rather of a logging strategy
at task level.

public abstract class Task implements Logger {

    public interface Logger {
        void log(Task task, String msg, int msgLevel);
    }

    /** If defined - holds the reference to a Logger */
    protected Logger loggerStrategy = this;

    /**
     * Setter for a new LoggerStrategy witch will handle all
     * further log activities for this task.
     * <p>
     * @param loggerStrategy reference to a Logger witch will
     *          handle all subsequent log activities for this
     *          task
     */
    public void setLoggerStrategy(Logger loggerStrategy) {
        this.loggerStrategy = loggerStrategy;
    }

--> change of old methode
    /**
     * Log a mesage with the given priority.
     *
     * @param the message to be logged.
     * @param msgLevel the message priority at which this message is to be
logged.
     */
    public void log(String msg, int msgLevel) {
        loggerStrategy.log(this, msg, msgLevel);
    }
--> end of change

    /**
     * Default implementation of the Logger - Strategy. Will be
     * automaticely called in case no other Logger has been defined.
     * <p>
     * <b>Warning: </b>Do not call this methode directly. Use
     * log(String, int) instead.
     * <p>
     * @see #log(String, int)
     */
    public void log(Task task, String msg, int msgLevel) {
        project.log(task, msg, msgLevel);
    }
end exerpt of Task

If the executing part needs to change the logging behaviour, this can be
done by setting a different loggingStrategy. I did this within my new Task
"parallel" to implement 3 different logging strategies (the user should be
able to decide what strategy fits best) e.g. sequential (all logmsgs from
task 1, then all of task 2, etc.) or marked (all logmsgs ass son as they
apear but designated with an extra identifier to distinguish the msgs in
log.

The System.out has to be handled at Task level (like javac did). Therefor it
should be feasable to only take care about the logging.

It's all done but I'm still waiting to see my earlier proposals
(http://marc.theaimsgroup.com/?l=ant-dev&m=97587019310230&w=2) to be
implemented in the ant repository because the new functionality is based on
them.

Thomas


Mime
View raw message