Skip to content

Commit 1b39628

Browse files
committed
Add useful information to existing logs in failure scenarios
1 parent 12f72c8 commit 1b39628

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/main/java/com/github/stickerifier/stickerify/bot/Stickerify.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,10 @@ private void processFailure(TelegramRequest request, Exception e, String fileId)
178178
}
179179

180180
if (e instanceof CorruptedFileException) {
181-
LOGGER.at(Level.INFO).log("Unable to reply to the request: the file is corrupted");
181+
LOGGER.at(Level.WARN).addKeyValue("file_id", fileId).log("Unable to reply to the request: the file is corrupted");
182182
answerText(CORRUPTED, request);
183183
} else {
184-
LOGGER.at(Level.WARN).setCause(e).addKeyValue("file_id", fileId).log("Unable to process file");
184+
LOGGER.at(Level.ERROR).setCause(e).addKeyValue("file_id", fileId).log("Unable to process file");
185185
answerText(ERROR, request);
186186
}
187187
}
@@ -206,7 +206,7 @@ private boolean processTelegramFailure(TelegramApiException e, boolean logUnmatc
206206
private void answerText(TelegramRequest request) {
207207
var message = request.message();
208208
if (message.text() == null) {
209-
LOGGER.at(Level.INFO).log("An unhandled message type has been received");
209+
LOGGER.at(Level.INFO).addKeyValue("original_request", message).log("An unhandled message type has been received");
210210
}
211211

212212
answerText(request.getAnswerMessage(), request);

0 commit comments

Comments
 (0)