Coverage for pyanaconda/anaconda_loggers.py: 0%

# Coverage for pyanaconda/anaconda_loggers.py : 0%

## 28 statements 0 run 28 missing 0 excluded

Hot-keys on this page

r m x p toggle line displays

j k next/prev highlighted chunk

0 (zero) top of page

1 (one) first highlighted chunk

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | # # anaconda_loggers.py : provides Anaconda specififc loggers # # Copyright (C) 2017 Red Hat, Inc. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # # Q: Why do we have a separate module for this? # # A: To avoid import cycles. The anaconda_logging module would be a natural # place for this function, but it unfrotunatelly imports the flags module. # And the flags module would have to import anaconda_logging to obtain the # get_module_logger() function, resulting in an import cycle. # We should be able to avoid this be placing the get_logger() function # in its own module that does not import any Anaconda modules other # than the constants module. import logging from pyanaconda.core import constants def get_module_logger(module_name): """Return anaconda sub-logger based on a module __name__ attribute. Currently we just strip the "pyanaconda." prefix (if any) and then put the string behind "anaconda.". After thet we use the result to get the correspondong sub-logger. """ if module_name.startswith("pyanaconda."): module_name = module_name[11:] return logging.getLogger("anaconda.%s" % module_name) def get_anaconda_root_logger(): return logging.getLogger(constants.LOGGER_ANACONDA_ROOT) def get_main_logger(): return logging.getLogger(constants.LOGGER_MAIN) def get_stdout_logger(): return logging.getLogger(constants.LOGGER_STDOUT) def get_stderr_logger(): return logging.getLogger(constants.LOGGER_STDERR) def get_program_logger(): return logging.getLogger(constants.LOGGER_PROGRAM) def get_storage_logger(): return logging.getLogger(constants.LOGGER_STORAGE) def get_packaging_logger(): return logging.getLogger(constants.LOGGER_PACKAGING) def get_dnf_logger(): return logging.getLogger(constants.LOGGER_DNF) def get_blivet_logger(): return logging.getLogger(constants.LOGGER_BLIVET) def get_ifcfg_logger(): return logging.getLogger(constants.LOGGER_IFCFG) def get_sensitive_info_logger(): return logging.getLogger(constants.LOGGER_SENSITIVE_INFO)