Floating-Dartists / matomo-tracker

A fully cross-platform wrap of the Matomo tracking client for Flutter, using the Matomo API.
https://pub.dev/packages/matomo_tracker
MIT License
26 stars 28 forks source link

Feat/add verbose flag #57

Closed TesteurManiak closed 1 year ago

TesteurManiak commented 1 year ago

Added the verbose flag to Matomo.instance.initialize() method.

I had to refactor a bit the way we handle logs so it could be testable.

Pierre-Monier commented 1 year ago

Setting verbose to false seem to disable every log. Maybe we want to always keep severe logs. Or instead of a boolean flag, we can let the user directly set the log level he want

TesteurManiak commented 1 year ago

@Pierre-Monier That's fair, may I suggest that we adopt a logic similar to the logging package which means that the Logger class would have a level setter to define the minimum level of the log to be displayed. By default the level would be Level.info so it would still display log of Level.severe while ignoring Level.fine message or lower. And can be changed on the fly just by doing Matomo.instance.log.level = Level.all.

Pierre-Monier commented 1 year ago

@Pierre-Monier That's fair, may I suggest that we adopt a similar logic that the logging package which means that the Logger class would have a level setter to define the minimum level of the log to be displayed. By default the level would be Level.info so it would still display log of Level.severe while ignoring Level.fine message or lower. And can be changed on the fly just by doing Matomo.instance.log.level = Level.all.

I mostly agree with it. However, in my opinion, the log level should be set during initialization. This is when we configure the package, so it makes sense to set the log level at this stage.