ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ilya Sterin" <ster...@gmail.com>
Subject Removing logging from ivy
Date Wed, 24 Sep 2008 19:17:26 GMT
I'm using ivy embedded in a library.  Because the library encapsulates
everything, we wanted to remove all logging...

Doing this...

Ivy ivy = Ivy.newInstance();
MessageLogger logger = new DefaultMessageLogger(0);
ivy.getLoggerEngine().setDefaultLogger(logger);

Removes the logging, but the transfer listeners are currently not
removable from what I can see.  Because the default transfer handler
is pushed into the transfer handlers as an anonymous inner class,
there is no way to remove it, as all remove methods requires an
instance of the transfer listener to remove it.

public void removeAllTransferListeners() {
    for (TransferListener tl : listeners.getListeners(TransferListener.class)) {
        removeTransferListener(tl);
    }
}

I then just use...

ivy.getEventManager().removeAllTransferListeners();

which removes the transfer download progress notifications.

To be able to remove all listeners if needed.  This is a nice
solution, but I'm not sure if there is a better way to configure this.

Can this or a similar solution be added to ivy?

I'd also like to discuss refining an ivy API for external use.  I can
imagine systems using ivy to resolve deps outside of ant as we're
doing.

Thanks.

Ilya

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message