Skip to content
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public synchronized void init(ProcessingEnvironment processingEnv) {
plugins.add(0, corePlugin);
androidAnnotationsEnv.setPlugins(plugins);
} catch (Exception e) {
LOGGER.error("Can't load plugins", e);
LOGGER.error(e, "Can't load plugins");
}
}

Expand Down Expand Up @@ -246,7 +246,7 @@ private void handleException(Set<? extends TypeElement> annotations, RoundEnviro
Iterator<? extends TypeElement> iterator = annotations.iterator();
if (iterator.hasNext()) {
Element element = roundEnv.getElementsAnnotatedWith(iterator.next()).iterator().next();
LOGGER.error("Something went wrong: {}", element, errorMessage);
LOGGER.error(element, "Something went wrong: {}", errorMessage);
} else {
LOGGER.error("Something went wrong: {}", errorMessage);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public OutputStream openBinary(JPackage pkg, String fileName) throws IOException

return sourceFile.openOutputStream();
} catch (FilerException e) {
LOGGER.error("Could not generate source file for {}", qualifiedClassName, e.getMessage());
LOGGER.error("Could not generate source file for {} due to error: {}", qualifiedClassName, e.getMessage());
/*
* This exception is expected, when some files are created twice. We
* cannot delete existing files, unless using a dirty hack. Files a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ private boolean generateElements(AnnotationElements validatedModel, ProcessHolde
if (validatedElements.contains(enclosingElement)) {
isElementRemaining = true;
} else {
LOGGER.error("Enclosing element {} has not been successfully validated", annotatedElement, enclosingElement);
LOGGER.error(annotatedElement, "Enclosing element {} has not been successfully validated", enclosingElement);
}
} else {
GeneratedClassHolder generatedClassHolder = generatingAnnotationHandler.createGeneratedClassHolder(environment, typeElement);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,17 @@ public AnnotationElements validate(AnnotationElements extractedModel, Annotation

AnnotationMirror annotationMirror = elementValidation.getAnnotationMirror();
for (ElementValidation.Error error : elementValidation.getErrors()) {
LOGGER.error(error.getMessage(), error.getElement(), annotationMirror);
LOGGER.error(error.getElement(), annotationMirror, error.getMessage());
}

for (String warning : elementValidation.getWarnings()) {
LOGGER.warn(warning, elementValidation.getElement(), annotationMirror);
LOGGER.warn(elementValidation.getElement(), annotationMirror, warning);
}

if (elementValidation.isValid()) {
validatedAnnotatedElements.add(annotatedElement);
} else {
LOGGER.warn("Element {} invalidated by {}", annotatedElement, annotatedElement, validatorSimpleName);
LOGGER.warn(annotatedElement, "Element {} invalidated by {}", annotatedElement, validatorSimpleName);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/**
* Copyright (C) 2010-2016 eBusiness Information, Excilys Group
* Copyright (C) 2016-2018 the AndroidAnnotations project
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
Expand Down Expand Up @@ -29,74 +30,54 @@ public Logger(LoggerContext loggerContext, String name) {
}

public void trace(String message, Object... args) {
trace(message, null, args);
}

public void trace(String message, Element element, Object... args) {
log(Level.TRACE, message, element, null, null, args);
log(Level.TRACE, message, null, null, null, args);
}

public void debug(String message, Object... args) {
debug(message, null, args);
}

public void debug(String message, Element element, Object... args) {
log(Level.DEBUG, message, element, null, null, args);
log(Level.DEBUG, message, null, null, null, args);
}

public void info(String message, Object... args) {
info(message, null, args);
}

public void info(String message, Element element, Object... args) {
log(Level.INFO, message, element, null, null, args);
log(Level.INFO, message, null, null, null, args);
}

public void warn(String message, Object... args) {
warn(message, null, null, args);
}

public void warn(String message, Throwable thr, Object... args) {
warn(message, null, thr, args);
}

public void warn(String message, Element element, Object... args) {
warn(message, element, null, args);
warn(null, message, args);
}

public void warn(String message, Element element, Throwable thr, Object... args) {
log(Level.WARN, message, element, null, thr, args);
public void warn(Element element, String message, Object... args) {
log(Level.WARN, message, element, null, null, args);
}

public void warn(String message, Element element, AnnotationMirror annotationMirror) {
public void warn(Element element, AnnotationMirror annotationMirror, String message) {
log(Level.WARN, message, element, annotationMirror, null);
}

public void error(String message, Object... args) {
error(message, null, null, args);
error(null, null, message, args);
}

public void error(String message, Element element, Object... args) {
error(message, element, null, args);
public void error(Element element, String message, Object... args) {
error(element, null, message, args);
}

public void error(String message, Throwable thr, Object... args) {
error(message, null, thr, args);
public void error(Throwable thr, String message, Object... args) {
error(null, thr, message, args);
}

public void error(String message, Element element, Throwable thr, Object... args) {
public void error(Element element, Throwable thr, String message, Object... args) {
log(Level.ERROR, message, element, null, thr, args);
}

public void error(String message, Element element, AnnotationMirror annotationMirror) {
public void error(Element element, AnnotationMirror annotationMirror, String message) {
log(Level.ERROR, message, element, annotationMirror, null);
}

public boolean isLoggable(Level level) {
return level.isGreaterOrEquals(loggerContext.getCurrentLevel());
}

public void log(Level level, String message, Element element, AnnotationMirror annotationMirror, Throwable thr, Object... args) {
private void log(Level level, String message, Element element, AnnotationMirror annotationMirror, Throwable thr, Object... args) {
if (!isLoggable(level)) {
return;
}
Expand Down