Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import logging
- from file2 import My_module
- class A:
- def __init__(self):
- log_1 = logging.getLogger("log1")
- log_1.setLevel("DEBUG")
- log_2 = logging.getLogger("log2")
- log_2.setLevel("ERROR")
- obj = My_module()
- import logging
- from file2 import My_module
- class My_module:
- def __init__(self):
- # I want this logger to use the same settings set in file1.py,
- # since it uses the same logger_name as 'log2'
- log = logging.getLogger("log2")
- # I should only see the 'ERROR' prints as per the 'log2' setting
- log.debug("My-mod DEBUG")
- log.info("My-mod INFO")
- log.error("My-mod ERROR")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement