Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1041 from M4rtinK/master-structured_logging_plus
Structured logging
- Loading branch information
Showing
98 changed files
with
564 additions
and
395 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# | ||
# 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 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_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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.