Search in sources :

Example 1 with ILogAlertListener

use of com.biglybt.core.logging.ILogAlertListener in project BiglyBT by BiglySoftware.

the class LoggerImpl method addAlertListener.

@Override
public void addAlertListener(final LogAlertListener listener) {
    ILogAlertListener lg_listener = new ILogAlertListener() {

        private HashSet set = new HashSet();

        @Override
        public void alertRaised(LogAlert alert) {
            if (!alert.repeatable) {
                if (set.contains(alert.text)) {
                    return;
                }
                set.add(alert.text);
            }
            listener.alertRaised(alert);
        }
    };
    alert_listeners_map2.put(listener, lg_listener);
    com.biglybt.core.logging.Logger.addListener(lg_listener);
}
Also used : ILogAlertListener(com.biglybt.core.logging.ILogAlertListener) LogAlert(com.biglybt.core.logging.LogAlert)

Example 2 with ILogAlertListener

use of com.biglybt.core.logging.ILogAlertListener in project BiglyBT by BiglySoftware.

the class LoggerImpl method addAlertListener.

@Override
public void addAlertListener(final LoggerAlertListener listener) {
    ILogAlertListener lg_listener = new ILogAlertListener() {

        @Override
        public void alertRaised(LogAlert alert) {
            if (alert.err == null) {
                int type;
                if (alert.entryType == LogAlert.AT_INFORMATION) {
                    type = LoggerChannel.LT_INFORMATION;
                } else if (alert.entryType == LogAlert.AT_WARNING) {
                    type = LoggerChannel.LT_WARNING;
                } else {
                    type = LoggerChannel.LT_ERROR;
                }
                listener.alertLogged(type, alert.text, alert.repeatable);
            } else
                listener.alertLogged(alert.text, alert.err, alert.repeatable);
        }
    };
    alert_listeners_map.put(listener, lg_listener);
    com.biglybt.core.logging.Logger.addListener(lg_listener);
}
Also used : ILogAlertListener(com.biglybt.core.logging.ILogAlertListener) LogAlert(com.biglybt.core.logging.LogAlert)

Aggregations

ILogAlertListener (com.biglybt.core.logging.ILogAlertListener)2 LogAlert (com.biglybt.core.logging.LogAlert)2