All Downloads are FREE. Search and download functionalities are using the official Maven repository.

liquibase.logging.core.CompositeLogService Maven / Gradle / Ivy

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);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy