Source code for vdat.command_interpreter.helpers

# Virus Data Analysis Tool: a data reduction GUI for HETDEX/VIRUS data
# Copyright (C) 2015, 2016  "The HETDEX collaboration"
#
# 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 3 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 <https://www.gnu.org/licenses/>.
"""Helper function and classes.

These functionalities are not essential for the interpreter, but can help the
to setup things.
"""
from __future__ import (absolute_import, division, print_function,
                        unicode_literals)

import logging
import sys

















[docs]def log_command_logger(string_primary, string_command, string_info, string_warning, string_error, string_critical, dict_config): """Function that log the command, and the strings_{info,warning,error,critical} to a logger called with the name of the executable, from the first element of the string command. Can be connected to :class:`vdat.command_interpreter.signals.CICommandLogger` """ exe = string_command.split()[0] log = logging.getLogger(name=exe) log.info(string_command) if string_info: log.info(string_info) if string_warning: log.warning(string_warning) if string_error: log.error(string_error) if string_critical: log.critical(string_critical)