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

com.redhat.ceylon.compiler.typechecker.io.cmr.impl.LeakingLogger Maven / Gradle / Ivy

There is a newer version: 1.3.3
Show newest version
package com.redhat.ceylon.compiler.typechecker.io.cmr.impl;

import com.redhat.ceylon.common.log.Logger;

import java.util.ArrayList;
import java.util.List;

/**
 * Logger that exposes its logs with programmatic API and let them be reset
 *
 * @author Emmanuel Bernard 
 */
public class LeakingLogger implements Logger {
    private List errors = new ArrayList();
    private List warnings = new ArrayList();
    //grammatically incorrect but more regular in the codebase
    private List infos = new ArrayList();
    private List debugs = new ArrayList();

    @Override
    public void error(String s) {
        errors.add(s);
    }

    @Override
    public void warning(String s) {
        warnings.add(s);
    }

    @Override
    public void info(String s) {
        infos.add(s);
    }

    @Override
    public void debug(String s) {
        debugs.add(s);
    }

    public void clear() {
        debugs.clear();
        infos.clear();
        warnings.clear();
        errors.clear();
    }

    public List getErrors() {
        return errors;
    }

    public List getWarnings() {
        return warnings;
    }

    public List getInfos() {
        return infos;
    }

    public List getDebugs() {
        return debugs;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy