Skip to content

Commit

Permalink
Merge pull request #23 from besbes/master
Browse files Browse the repository at this point in the history
Reduce logging level (#16)
  • Loading branch information
Vasily Karyaev authored Nov 7, 2018
2 parents 2cd7161 + bfe1c88 commit e7f4acc
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 e7f4acc

Please sign in to comment.