Skip to content

Commit

Permalink
remove exception, messager and add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
martinbonnin committed Apr 30, 2024
1 parent 2fb9c54 commit edd202b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,4 @@ interface ApolloCompilerPluginLogger {
fun info(message: String)
fun warn(message: String)
fun error(message: String)

fun exception(e: Throwable)
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,32 @@ import com.apollographql.apollo3.compiler.ApolloCompilerPluginLogger

@ApolloInternal
class GradleCompilerPluginLogger(val loglevel: Int) : ApolloCompilerPluginLogger {
private val messager = System.out

override fun logging(message: String) {
if (loglevel <= LOGGING_LEVEL_LOGGING)
messager.println("v: [apollo] $message")
println("v: [apollo] $message")
}

override fun info(message: String) {
if (loglevel <= LOGGING_LEVEL_INFO)
messager.println("i: [apollo] $message")
println("i: [apollo] $message")
}

override fun warn(message: String) {
if (loglevel <= LOGGING_LEVEL_WARN)
messager.println("w: [apollo] $message")
println("w: [apollo] $message")
}

override fun error(message: String) {
if (loglevel <= LOGGING_LEVEL_ERROR)
messager.println("e: [apollo] $message")
}

override fun exception(e: Throwable) {
if (loglevel <= LOGGING_LEVEL_ERROR)
messager.println("e: [apollo] $e")
println("e: [apollo] $message")
}

companion object {
/**
* Matches Gradle LogLevel
* See https://github.com/gradle/gradle/blob/71f42531a742bc263c61f1d0dc21bb6570cc817b/platforms/core-runtime/logging-api/src/main/java/org/gradle/api/logging/LogLevel.java#L21
*/
const val LOGGING_LEVEL_LOGGING = 0
const val LOGGING_LEVEL_INFO = 1
const val LOGGING_LEVEL_WARN = 3
Expand Down

0 comments on commit edd202b

Please sign in to comment.