Skip to content
Browse files

Removed is[Level]Enabled usage, since it's an anti-pattern.

  • Loading branch information...
1 parent 2efa3bd commit d6108a4ebfa1705ca37049b029c238892d849b53 @pgelinas pgelinas committed Dec 3, 2012
View
11 org.ektorp.android/src/main/java/org/ektorp/android/http/AndroidHttpClient.java
@@ -129,9 +129,7 @@ public HttpResponse copy(String sourceUri, String destination) {
private HttpResponse executePutPost(HttpEntityEnclosingRequestBase request,
String content, boolean useBackend) {
try {
- if (LOG.isTraceEnabled()) {
- LOG.trace("Content: {}", content);
- }
+ LOG.trace("Content: {}", content);
StringEntity e = new StringEntity(content, "UTF-8");
e.setContentType("application/json");
request.setEntity(e);
@@ -156,11 +154,8 @@ private HttpResponse executeRequest(HttpRequestBase request, boolean useBackend)
} else {
rsp = client.execute((HttpHost)client.getParams().getParameter(ClientPNames.DEFAULT_HOST), request);
}
- if (LOG.isTraceEnabled()) {
- LOG.trace(String.format("%s %s %s %s", request.getMethod(),
- request.getURI(), rsp.getStatusLine().getStatusCode(),
- rsp.getStatusLine().getReasonPhrase()));
- }
+ LOG.trace("{} {} {} {}", new Object[] { request.getMethod(), request.getURI(),
+ rsp.getStatusLine().getStatusCode(), rsp.getStatusLine().getReasonPhrase() });
return AndroidHttpResponse.of(rsp, request);
} catch (Exception e) {
throw Exceptions.propagate(e);
View
4 org.ektorp.android/src/main/java/org/ektorp/android/util/CouchbaseViewListAdapter.java
@@ -113,9 +113,7 @@ protected void onSuccess() {
}
if(lastUpdateChangesFeed > lastUpdateView) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Finished, but still behind " + lastUpdateChangesFeed + " > " + lastUpdateView);
- }
+ LOG.debug("Finished, but still behind {} > {}", lastUpdateChangesFeed, lastUpdateView);
updateListItems();
}
View
11 org.ektorp/src/main/java/org/ektorp/http/StdHttpClient.java
@@ -122,9 +122,7 @@ public HttpResponse head(String uri) {
private HttpResponse executePutPost(HttpEntityEnclosingRequestBase request,
String content, boolean useBackend) {
try {
- if (LOG.isTraceEnabled()) {
- LOG.trace("Content: {}", content);
- }
+ LOG.trace("Content: {}", content);
StringEntity e = new StringEntity(content, "UTF-8");
e.setContentType("application/json");
request.setEntity(e);
@@ -151,11 +149,8 @@ private HttpResponse executeRequest(HttpUriRequest request, boolean useBackend)
} else {
rsp = client.execute((HttpHost)client.getParams().getParameter(ClientPNames.DEFAULT_HOST), request);
}
- if (LOG.isTraceEnabled()) {
- LOG.trace(String.format("%s %s %s %s", request.getMethod(),
- request.getURI(), rsp.getStatusLine().getStatusCode(),
- rsp.getStatusLine().getReasonPhrase()));
- }
+ LOG.trace("{} {} {} {}", new Object[] { request.getMethod(), request.getURI(),
+ rsp.getStatusLine().getStatusCode(), rsp.getStatusLine().getReasonPhrase() });
return StdHttpResponse.of(rsp, request);
} catch (Exception e) {
throw Exceptions.propagate(e);
View
16 org.ektorp/src/main/java/org/ektorp/impl/StdCouchDbConnector.java
@@ -180,10 +180,7 @@ public AttachmentInputStream getAttachment(final String id,
assertDocIdHasValue(id);
Assert.hasText(attachmentId, "attachmentId may not be null or empty");
- if (LOG.isTraceEnabled()) {
- LOG.trace("fetching attachment for doc: {} attachmentId: {}", id,
- attachmentId);
- }
+ LOG.trace("fetching attachment for doc: {} attachmentId: {}", id, attachmentId);
return getAttachment(attachmentId, dbURI.append(id).append(attachmentId));
}
@@ -194,10 +191,7 @@ public AttachmentInputStream getAttachment(String id, String attachmentId,
Assert.hasText(attachmentId, "attachmentId may not be null or empty");
Assert.hasText(revision, "revision may not be null or empty");
- if (LOG.isTraceEnabled()) {
- LOG.trace("fetching attachment for doc: {} attachmentId: {}", id,
- attachmentId);
- }
+ LOG.trace("fetching attachment for doc: {} attachmentId: {}", id, attachmentId);
return getAttachment(attachmentId, dbURI.append(id).append(attachmentId).param("rev", revision));
}
@@ -448,10 +442,8 @@ public String getDatabaseName() {
Assert.notNull(type, "type may not be null");
query.dbPath(dbURI.toString());
- if (LOG.isDebugEnabled()) {
- LOG.debug("startKey: {}", pr.getStartKey());
- LOG.debug("startDocId: {}", pr.getStartKeyDocId());
- }
+ LOG.debug("startKey: {}", pr.getStartKey());
+ LOG.debug("startDocId: {}", pr.getStartKeyDocId());
PageResponseHandler<T> ph = new PageResponseHandler<T>(pr, type, objectMapper, query.isIgnoreNotFound());
query = PageRequest.applyPagingParameters(query, pr);
View
9 org.ektorp/src/main/java/org/ektorp/impl/StreamingJsonSerializer.java
@@ -81,12 +81,9 @@ public void run() {
*/
public String toJson(Object o) {
try {
- if (LOG.isDebugEnabled()) {
- String json = objectMapper.writeValueAsString(o);
- LOG.debug(json);
- return json;
- }
- return objectMapper.writeValueAsString(o);
+ String json = objectMapper.writeValueAsString(o);
+ LOG.debug(json);
+ return json;
} catch (Exception e) {
throw Exceptions.propagate(e);
}
View
2 org.ektorp/src/main/java/org/ektorp/support/CouchDbRepositorySupport.java
@@ -291,7 +291,7 @@ private void initDesignDocInternal(int invocations) {
initDesignDocInternal(1);
}
}
- } else if (log.isDebugEnabled()){
+ } else {
log.debug("DesignDocument was unchanged. Database was not updated.");
}
}

0 comments on commit d6108a4

Please sign in to comment.
Something went wrong with that request. Please try again.