Skip to content

Commit

Permalink
Reduce logging level (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
besbes committed Nov 29, 2017
1 parent 2cd7161 commit bfe1c88
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main/java/com/ecwid/maleorang/MailchimpClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,24 @@ open class MailchimpClient protected constructor (
val methodInfo = MailchimpMethodInfo(method)
val request = Connector.Request(methodInfo.httpMethod.name, methodInfo.buildUrl(apiKey), "ignorable", apiKey, methodInfo.requestBody)

if (log.isLoggable(Level.INFO)) {
if (log.isLoggable(Level.FINEST)) {
val sb = StringBuilder("Request: ")
sb.append(request.method).append(' ').append(request.url)
if (request.requestBody != null) {
sb.append('\n').append("Body: ").append(request.requestBody)
}
log.info(sb.toString())
log.finest(sb.toString())
}

val response = connector.call(request)

if (log.isLoggable(Level.INFO)) {
if (log.isLoggable(Level.FINEST)) {
val sb = StringBuilder("Response: ")
sb.append(response.statusCode).append(' ').append(response.reasonPhrase)
if (response.responseBody != null) {
sb.append('\n').append("Body: ").append(response.responseBody)
}
log.info(sb.toString())
log.finest(sb.toString())
}

if (response.statusCode !in 200..299) {
Expand Down

0 comments on commit bfe1c88

Please sign in to comment.