aboutsummaryrefslogtreecommitdiff
path: root/juick-api/src/main/java/com/juick/api/TGBot.java
diff options
context:
space:
mode:
authorGravatar Alexander Alexeev2016-11-30 15:10:15 +0700
committerGravatar Alexander Alexeev2016-11-30 15:10:15 +0700
commit1d837a835c04078ec66325e9fb9de21ac401874e (patch)
tree428217d2c617b9caf2eb6d42a7716789881d0937 /juick-api/src/main/java/com/juick/api/TGBot.java
parentb45c000ed478f2407288aab1532425288f998689 (diff)
prevent string concatenation for disabled loggers
Diffstat (limited to 'juick-api/src/main/java/com/juick/api/TGBot.java')
-rw-r--r--juick-api/src/main/java/com/juick/api/TGBot.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/juick-api/src/main/java/com/juick/api/TGBot.java b/juick-api/src/main/java/com/juick/api/TGBot.java
index e0ab3e1e..d532b02c 100644
--- a/juick-api/src/main/java/com/juick/api/TGBot.java
+++ b/juick-api/src/main/java/com/juick/api/TGBot.java
@@ -79,7 +79,10 @@ public class TGBot implements AutoCloseable {
public void onTextMessage(WebSocket websocket, String text) throws Exception {
super.onTextMessage(websocket, text);
com.juick.Message jmsg = ms.readValue(text, com.juick.Message.class);
- logger.info("got jmsg: " + ms.writeValueAsString(jmsg));
+
+ if (logger.isInfoEnabled()) // prevent writeValueAsString execution if logger disabled
+ logger.info("got jmsg: {}", ms.writeValueAsString(jmsg));
+
String msgUrl = formatUrl(jmsg);
if (jmsg.getRid() == 0) {
String msg = formatPost(jmsg);
@@ -118,7 +121,7 @@ public class TGBot implements AutoCloseable {
bot.execute(telegramMessage, new Callback<SendMessage, SendResponse>() {
@Override
public void onResponse(SendMessage request, SendResponse response) {
- logger.info("got response: " + response.message().toString());
+ logger.info("got response: {}", response.message());
}
@Override
@@ -140,7 +143,7 @@ public class TGBot implements AutoCloseable {
})), new Callback<SendMessage, SendResponse>() {
@Override
public void onResponse(SendMessage request, SendResponse response) {
- logger.info("got response: " + response.message().toString());
+ logger.info("got response: {}", response.message());
}
@Override