Add option to change print function#145
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #145 +/- ##
==========================================
- Coverage 96.29% 96.03% -0.26%
==========================================
Files 8 8
Lines 729 732 +3
Branches 111 112 +1
==========================================
+ Hits 702 703 +1
- Misses 21 22 +1
- Partials 6 7 +1
Continue to review full report in Codecov by Sentry.
|
|
added some commits to please lint checker |
I actually don't know whats wrong with my code (if so). But my feature is working correctly, so please review and merge it |
| *, | ||
| warnings: 'Optional[bool]' = None, | ||
| highlight: 'Optional[bool]' = None, | ||
| logger_function: 'Optional[Callable[[str], None]]' = None, |
There was a problem hiding this comment.
If logger_function would have the same signature as print, you could initialize it to print per default.
That way you can get rid of the conditional code in __call__. One might have to wrap a logger into a lambda to ignore the additonal file/flush arguments.
While I am not involved with the project, you might be able to fix your issue: apparently you overindented something, try reformatting with black and committing. You can see the ci issue here: https://github.com/samuelcolvin/python-devtools/actions/runs/6684613574/job/18162063139?pr=145#step:6:158 |
I added logger_function parameter to Debug() class that replaces print if set. Here is an example of usage with loguru: