com.applitools.eyes.MultiLogHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of eyes-common-java5 Show documentation
Show all versions of eyes-common-java5 Show documentation
Common code for Applitools Eyes Java SDK projects
package com.applitools.eyes;
import com.applitools.eyes.logging.ClientEvent;
import com.applitools.eyes.logging.TraceLevel;
import java.util.*;
public class MultiLogHandler extends LogHandler {
final Set logHandlers = Collections.synchronizedSet(new HashSet());
public MultiLogHandler(LogHandler... logHandlers) {
super(TraceLevel.Debug);
if (logHandlers == null || logHandlers.length == 0) {
return;
}
this.logHandlers.addAll(Arrays.asList(logHandlers));
}
public void addLogHandler(LogHandler logHandler) {
logHandlers.add(logHandler);
}
public void clear() {
logHandlers.clear();
}
@Override
public void open() {
synchronized (logHandlers) {
for (LogHandler logHandler : logHandlers) {
logHandler.open();
}
}
}
@Override
public void onMessageInner(ClientEvent event) {
synchronized (logHandlers) {
for (LogHandler logHandler : logHandlers) {
logHandler.onMessage(event);
}
}
}
@Override
public void close() {
synchronized (logHandlers) {
for (LogHandler logHandler : logHandlers) {
logHandler.close();
}
}
}
@Override
public boolean isOpen() {
return true;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy