Skip to content

Commit

Permalink
Improve logging
Browse files Browse the repository at this point in the history
  • Loading branch information
aNNiMON committed Jun 14, 2024
1 parent 04b7d7f commit dabe648
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions module/src/main/java/com/annimon/tgbotsmodule/Runner.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ private void initWebHook(@NotNull List<? extends BotModule> botModules) {
.updateHandler(bot::onWebhookUpdateReceived)
.build());
} catch (TelegramApiException ex) {
log.error("register webhook bot", ex);
log.error("register webhook bot: " + module, ex);
}
}
} catch (TelegramApiException e) {
Expand All @@ -150,7 +150,7 @@ private void initLongPolling(@NotNull List<@NotNull ? extends BotModule> botModu
options.getUpdatesGenerator(),
handler);
} catch (TelegramApiException ex) {
log.error("register long polling bot", ex);
log.error("register long polling bot: " + module, ex);
}
}
} catch (Exception ex) {
Expand All @@ -172,8 +172,8 @@ private Optional<Config> loadConfigFromResource() {
return Optional.of(configLoader.loadResource(path, Config.class));
}
} catch (ConfigLoaderException cle) {
// TODO more informative message
log.info("Unable to load config from resource. Trying to load from file…");
log.info("Unable to load a config from resource for profile " + profile
+ ". Trying to load from file…", cle);
}
return Optional.empty();
}
Expand All @@ -183,8 +183,8 @@ private Optional<Config> loadConfigFromFile() {
var path = configLoader.configFile("config", profile);
return Optional.of(configLoader.loadFile(path, Config.class));
} catch (ConfigLoaderException cle) {
// TODO more informative message
log.info("Unable to load config file. Switch to default configuration.");
log.info("Unable to load a config file for profile " + profile
+ ". Switching to default configuration.", cle);
}
return Optional.empty();
}
Expand All @@ -197,7 +197,7 @@ private BotModule moduleInstance(@NotNull String className) {
.getDeclaredConstructor()
.newInstance();
} catch (Exception ex) {
log.warn("Unable to load module " + className);
log.warn("Unable to load module {}", className);
return null;
}
}
Expand Down

0 comments on commit dabe648

Please sign in to comment.