cinar / indicator

Indicator is a Golang module that provides a rich set of technical analysis indicators, strategies, and a framework for backtesting.
GNU Affero General Public License v3.0
524 stars 103 forks source link

Ability to control library logs/output #224

Closed ibyter closed 2 months ago

ibyter commented 2 months ago

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 commented 2 months ago

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

cinar commented 2 months ago

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

ibyter commented 2 months ago

Yes I am using slog package, and PR looks good

cinar commented 2 months ago

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