Python Forum

Full Version: What is the best way to set application-wide config values?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I want to write a custom logger and I want to configure the logger once, and import the logger in multiple classes. I would like to do this without using the singleton decorator. The default logger (https://docs.python.org/2/howto/logging....le-modules)[supports logging] from multiple modules, but I'm not sure how this is accomplished. If I have an application where I want to start the application, set the configuration for my own module, and import that module into other classes in the application so that I an access the configuration information, what is the best way to accomplish that?
(May-07-2020, 04:59 PM)ajorona Wrote: [ -> ]I want to write a custom logger
And why would you want to reinvent the wheel? Use the built-in module and customize the logger to fit your needs.

Also, you link to python2 docs. You should work with python3, not python2