com.vinaygaba.codegen.logging.Logger.kt Maven / Gradle / Ivy
package com.vinaygaba.codegen.logging
import javax.annotation.processing.Messager
import javax.tools.Diagnostic
class Logger {
private val loggedExceptions: MutableList = mutableListOf()
fun logMessage(message: String) {
logError(Exception(message))
}
fun logError(e: Exception) {
loggedExceptions += e
}
fun publishMessages(messager: Messager?) {
loggedExceptions.forEach { messager?.printMessage(Diagnostic.Kind.ERROR, "${it.message}") }
}
}