Closed crrobinson14 closed 5 years ago
I'm happy to file a PR to document this.
Please do!
Also, if you are open to it, I would include in the PR enhancing this to be a log level
Sure! I think it would also be good to be able to just pass an object supplying your custom logger
This ticket is just to ask what is the most appropriate file to add it to.
Don't have a good idea right now -- maybe start a new "Tips & Tricks" document under "Advanced"? https://github.com/Nozbe/WatermelonDB/tree/master/docs#advanced-guides — there's a lot of undocumented tips like this :)
Sorry this took so long. What do you think of the PR above? I added an actual document called Logging because it felt like something that can be expanded over time.
For what it's worth, this seems like really strange behaviour to me. Overriding a global singleton logger is going to be subject to race conditions and a lot of other weird behaviour.
I suggest that a logLevel
property is added/maintained. If that is undesirable, it would make a lot more sense to add and optional logger to the configuration, so that users can fine tune things how they like.
@isaachinman This thread has been dead for 4 years. If you would like to suggest a change, you would best off starting a new thread and/or (ideally) opening a new PR with your suggestion.
I discovered that there is a built-in way used by the test suite to reduce the logging. It feels like something that should be documented because it's useful to control this in many apps:
I'm happy to file a PR to document this. This ticket is just to ask what is the most appropriate file to add it to.
Also, if you are open to it, I would include in the PR enhancing this to be a log level rather than on/off. The logger is set up with four log levels already but there is only the option to have all on or off. We could allow the logger to report database issues and warnings without logging the timing of every single query...