liquibase.logging.core.CompositeLogService Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of liquibase-core Show documentation
Show all versions of liquibase-core Show documentation
Liquibase is a tool for managing and executing database changes.
The newest version!
package liquibase.logging.core;
import liquibase.Scope;
import liquibase.logging.LogService;
import liquibase.logging.Logger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class CompositeLogService extends AbstractLogService {
private List services = new ArrayList<>();
public CompositeLogService() {
}
public CompositeLogService(boolean includeCurrentScopeLogService, LogService... logService) {
this.services = new ArrayList<>(Arrays.asList(logService));
if (includeCurrentScopeLogService) {
services.add(Scope.getCurrentScope().get(Scope.Attr.logService, LogService.class));
}
}
@Override
public int getPriority() {
return PRIORITY_NOT_APPLICABLE;
}
@Override
public Logger getLog(Class clazz) {
List loggers = new ArrayList<>();
for (LogService service : services) {
loggers.add(service.getLog(clazz));
}
return new CompositeLogger(loggers);
}
}