Closed voidpointer0x00 closed 4 months ago
I think the misunderstanding here is that setting a log level is not "Filtering". Slf4j actively checks what level the logger is set to and will not log a message if the level is disabled:
See: Slf4j AbstractLogger
public void info(String format, Object arg) {
if (isInfoEnabled()) {
handle_1ArgsCall(Level.INFO, null, format, arg);
}
}
Adding an additional toggle is a possibility, but there is already an option to disable the logging without having to add extra complexity. @addo47 would it be an option to downgrade the log to debug?
I think the misunderstanding here is that setting a log level is not "Filtering".
Yes, I guess I didn't put it the right way :smile:
No concerns with downgrade that log line to debug level, feel free to raise a PR against dv if not already done
Is your feature request related to a problem? Please describe. My app has it's own logging system and handles Telegram updates in it's own way. Currently I'm migrating commands to the abilities system. But the thing is, I don't want it to log any unnecessary stuff.
The logging code that I'm reffering to:
https://github.com/rubenlagus/TelegramBots/blob/7029a35cd01dae7f86428ad73e29a4a1d4b725e2/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/bot/BaseAbilityBot.java#L236-L263
Describe the solution you'd like Either one of these would solve the problem; we can just discuss which one suits the library the best and I'll me glad to make a PR implementing the thing.
Stream.of(...)...
code to a newprotected
executeAbilities
(?) method;this::...
package-protected
methods toprotected
, maybe mark asfinal
;Disputable:
update.toString()
or use Gson for that purpose — that's my main concern, it makes logs completely unreadable. https://github.com/rubenlagus/TelegramBots/blob/7029a35cd01dae7f86428ad73e29a4a1d4b725e2/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/bot/BaseAbilityBot.java#L238trace
level or add a selection for level.Describe alternatives you've considered Theoretically, in the overriden
#onUpdateReceived()
instead of callingsuper.onUpdateReceived(...)
I could just paste theStream.of(...
code, but most of the methods are package-protected.A temporary fix is log filtering, but in that case my inner optimization demon will keep me awake at nights telling me that somewhere code's doing unnecessary work :rofl: With logback it can be done changing log level for the
...BaseAbilityBot
logger: