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

com.appsingularity.postman.compiler.Logger Maven / Gradle / Ivy

There is a newer version: 1.1.1
Show newest version
package com.appsingularity.postman.compiler;

import android.support.annotation.NonNull;

import javax.annotation.processing.ProcessingEnvironment;
import javax.lang.model.element.Element;

import static javax.tools.Diagnostic.Kind.ERROR;
import static javax.tools.Diagnostic.Kind.NOTE;
import static javax.tools.Diagnostic.Kind.WARNING;

public class Logger {
    @NonNull
    private final ProcessingEnvironment mEnv;

    public Logger(@NonNull final ProcessingEnvironment env) {
        mEnv = env;
    }

    public void error(final Element element, String message, final Object... args) {
        if (args.length > 0) {
            message = String.format(message, args);
        }
        mEnv.getMessager().printMessage(ERROR, "Postman: " + message, element);
    }

    public void warn(final Element element, String message, final Object... args) {
        if (args.length > 0) {
            message = String.format(message, args);
        }
        mEnv.getMessager().printMessage(WARNING, "Postman: " + message, element);
    }

    public void note(String message, final Object... args) {
        if (args.length > 0) {
            message = String.format(message, args);
        }
        mEnv.getMessager().printMessage(NOTE, "Postman: " + message);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy