Skip to content

Commit

Permalink
(#171) Add log level guards
Browse files Browse the repository at this point in the history
  • Loading branch information
andreoss committed Jun 25, 2020
1 parent 37af735 commit c611845
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions src/main/java/com/jcabi/http/request/BaseRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -361,18 +361,20 @@ private Response fetchResponse(final InputStream stream)
this.read
);
final URI uri = URI.create(this.home);
Logger.info(
this,
"#fetch(%s %s%s %s): [%d %s] in %[ms]s",
this.mtd,
uri.getHost(),
// @checkstyle AvoidInlineConditionalsCheck (1 line)
uri.getPort() > 0 ? String.format(":%d", uri.getPort()) : "",
uri.getPath(),
response.status(),
response.reason(),
System.currentTimeMillis() - start
);
if (Logger.isInfoEnabled(this)) {
Logger.info(
this,
"#fetch(%s %s%s %s): [%d %s] in %[ms]s",
this.mtd,
uri.getHost(),
// @checkstyle AvoidInlineConditionalsCheck (1 line)
uri.getPort() > 0 ? String.format(":%d", uri.getPort()) : "",
uri.getPath(),
response.status(),
response.reason(),
System.currentTimeMillis() - start
);
}
return response;
}

Expand Down

0 comments on commit c611845

Please sign in to comment.