Often I will use a log in python with the following setup:
logging.basicConfig(
    format="(%(levelname)s) %(module)22s :  %(message)s",
    datefmt="%m/%d/%Y %I:%M:%S %p",
    level=logging.INFO,
)
log = logging.getLogger(__name__)
Sometimes I have a module m.py which can either be run by itself, or it can be called by another module.
If the module m.py is called as itself then I need all the setup outlined above, however, if m.py is called by a different module then the above isn't necessary, I can just have
log = logging.getLogger(__name__)
and it will inherit the logger that was created in the script that called m.py.
What I would like to know, is how to I have a setup which will take into account both of these scenarios for the script m.py?
 
    