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

Ability to control library logs/output #224

Closed
ibyter opened this issue Sep 17, 2024 · 4 comments · Fixed by #225
Closed

Ability to control library logs/output #224

ibyter opened this issue Sep 17, 2024 · 4 comments · Fixed by #225

Comments

@ibyter
Copy link

ibyter commented Sep 17, 2024

Currently when running a backtest:

...
backtest.Run()

Logs are printed alongside my app logs:

{"time":"2024-09-17T22:35:44.859099+03:00","level":"INFO","msg":"computing strategies outcomes","logger":"stockstrategy","stock":1628,"datesCount":2}
2024/09/17 22:35:44 Backtesting ABC...

my logs are structured {"time".., and get mixed with library logs 2024/09/17 22:35:44 Backtesting...

It would be best if we can control the logger inside the library

@cinar
Copy link
Owner

cinar commented Sep 18, 2024

Good point. Yes, this is something worth improving for sure. Are you using log/slog or the log/Logger?

@cinar
Copy link
Owner

cinar commented Sep 18, 2024

Please check the #225 PR to see if this will work for your use case.

@ibyter
Copy link
Author

ibyter commented Sep 18, 2024

Yes I am using slog package, and PR looks good

@cinar
Copy link
Owner

cinar commented Sep 18, 2024

Awesome, I just merged it. You can use it from release v2.1.5. Please reopen if you run into any issues.

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

Successfully merging a pull request may close this issue.

2 participants