-
Notifications
You must be signed in to change notification settings - Fork 0
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
Use standard python logging module rather than Log class #2
Comments
While it indeed seems like a good idea to use standard python logging at first glance, it turns out that doing so is severely complicated by typical python madness. The problem is that this will generate all kinds of side-effects when using pathpy with third-party packages, which mess with standard logging as well. This means that, for instance, the order in which packages are imported can break the logging of pathpy. What is worse, it will make logging really complicated in jupyter, because jupyter messes with logging defaults in a way that makes it impossible to properly use the logging package, without adding really ugly boilerplate code. I understand that these issues are due to bad practice of how packages (and jupyter) use the standard logging package. But unfortunately, the package is implemented (and documented) in such a crappy way that it neither prevents (nor warns about) this bad practice. Due to these issues, I am seriously considering reverting to the custom pathpy Log class. |
I agree that the logging module introduces some serious boilerplate code, and the problem that most modules in some way or an other use the logging module and thus can change the formatting loggin level and so forth is a problem. Some of it can be mediated by setting an appropriate logger and the stream to write to and avoid that any other modules write to it. However I think that the logging as I have seen it used is more as a feedback mechanism to the user that something is being done, not so much to have a time stamped history of events for later debugging (which is usefull but for that purpose the logging module has been devised specifically). An alternative to using logging as in "print a line for a completed task", would be to to allow the user to specify if he would like a |
If there's a way how we can make this convenient for users, I am more than happy to stick with the standard logging. However, we should accomodate for the most common use case, which is probably the use of pathpy in a jupyter notebook. I guess there is still a chance to make this convenient. I just haven't found it yet. |
I had looked at how ScikiLearn implements "verbose". What they do is to just to have a print statement if the variable I still would allow to explicitly silence the log output by the user, since it would leave several print statements in the notebook (for example reading a file if nothing goes wrong should probably not generate a log). As for longer executions a progress-bar (in a notebook) could be added. |
I can look into some ideas and we can discuss them here |
Kamino cloned this issue to uzhdag/pathpy |
No description provided.
The text was updated successfully, but these errors were encountered: