Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

logging is too opionated #620

Open
brettelliot opened this issue Nov 9, 2024 · 0 comments
Open

logging is too opionated #620

brettelliot opened this issue Nov 9, 2024 · 0 comments

Comments

@brettelliot
Copy link
Collaborator

Hi all,

I'm submitting this "issue" to open a discussion about logging in lumitbot. Today, lumibot makes 3 assumptions about logging that I think are incorrect:

  1. Lumibot assumes that everyone wants backtests to produce little or no logs
  2. Lumibot assumes that everyone wants live bots to show all logs info level or greater
  3. Lumibot assumes that it is the main app and therefore should control logging entirely

Let's talk about each...

Lumibot assumes that everyone wants backtests to produce little or no logs
The code in trader here forces console logging during backtesting to be error level or higher. I actually like seeing info logs in the console when building strategies and i can't be the only one. The whole point of logging levels is to allow people to set the level of logging to whatever they want. The workaround is to set the Trader to debug mode which seems wrong.

Lumibot assumes that everyone wants live bots to show all logs info level or greater
This line forces live bots to always log at the info level. Some people might not want that. For example, once everything in my bot is working i want to set the logging level to warning or error so my logs only tell me when things are going wrong. Typically, log_level is an env var and if i need to adjust it back to info, i can. Which takes us to point 3...

Lumibot assumes that it is the main app and therefore should control logging entirely
Lumibot removes all logging handlers and re-adds its own. This assumes that lumibot is the main app, which I will give you is probably a decent assumption. However, even given that assumption, i still think its incorrect to just hijack the logger and remove whatever people have added or changed. For example, if I add a logging handler to send me discord messages for warnings or errors, the Trader removes it.

Anyway, I'm really enjoying lumibot. I think ya'll built something pretty amazing. And i'm happy to keep contributing. And I won't touch logging again :) But I felt like documenting what I feel like are issues with lumibot logging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant