- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 50
Add option to change print function #145
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
base: main
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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: