You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to use my custom logger to catch all errors within all modules. For base logger I could just import logger in all modules and then use decorarator @logger.catch for all functions. What would be the best practice for custom logger? Should I pass it as the argument to submodules' functions and then explicitly call custom_logger.error() within except blocks?
Again, the advantage is that you can directly use the base logger in all your modules.
Otherwise, if you need to give specific access to custom_logger, the best practice is as you suggested to pass it as an argument of your functions, or to define it in a specific module and then import it in your modules:
Hello,
I have a programme with a bunch of modules. In the main module a have a custom logger:
I want to use my custom logger to catch all errors within all modules. For base logger I could just import logger in all modules and then use decorarator
@logger.catch
for all functions. What would be the best practice for custom logger? Should I pass it as the argument to submodules' functions and then explicitly callcustom_logger.error()
withinexcept
blocks?The text was updated successfully, but these errors were encountered: