Example #1
0
def setup_logging(opts):
    clear_root_handlers()
    if hasattr(opts, 'log_level'):
        log_level = opts.log_level or hollandcfg.lookup('logging.level')
    else:
        log_level = hollandcfg.lookup('logging.level')

    if (not opts.quiet):
        setup_console_logging(level=log_level)

    if hollandcfg.lookup('logging.filename'):
        try:
            if hollandcfg.lookup('logging.format'):
                setup_file_logging(
                    filename=str(hollandcfg.lookup('logging.filename')),
                    level=log_level,
                    format=hollandcfg.lookup(str('logging.format')))
            else:
                setup_file_logging(filename=str(
                    hollandcfg.lookup('logging.filename')),
                                   level=log_level)
        except IOError as exc:
            LOGGER.warn("Skipping file logging: %s", exc)

    # Monkey patch in routing warnings through logging
    old_showwarning = warnings.showwarning
    warnings.showwarning = log_warnings
Example #2
0
def setup_logging(opts):
    """
    Setup log file
    """
    clear_root_handlers()
    if hasattr(opts, "log_level"):
        log_level = opts.log_level or HOLLANDCFG.lookup("logging.level")
    else:
        log_level = HOLLANDCFG.lookup("logging.level")

    if not opts.quiet:
        setup_console_logging(level=log_level)

    if HOLLANDCFG.lookup("logging.filename"):
        try:
            if HOLLANDCFG.lookup("logging.format"):
                setup_file_logging(
                    filename=str(HOLLANDCFG.lookup("logging.filename")),
                    level=log_level,
                    msg_format=HOLLANDCFG.lookup(str("logging.format")),
                )
            else:
                setup_file_logging(
                    filename=str(HOLLANDCFG.lookup("logging.filename")), level=log_level
                )
        except IOError as exc:
            LOG.warning("Skipping file logging: %s", exc)
Example #3
0
def setup_logging(opts):
    """
    Setup log file
    """
    clear_root_handlers()
    if hasattr(opts, "log_level"):
        log_level = opts.log_level or HOLLANDCFG.lookup("logging.level")
    else:
        log_level = HOLLANDCFG.lookup("logging.level")

    if not opts.quiet:
        setup_console_logging(level=log_level)

    if HOLLANDCFG.lookup("logging.filename"):
        try:
            if HOLLANDCFG.lookup("logging.format"):
                setup_file_logging(
                    filename=str(HOLLANDCFG.lookup("logging.filename")),
                    level=log_level,
                    msg_format=HOLLANDCFG.lookup(str("logging.format")),
                )
            else:
                setup_file_logging(filename=str(
                    HOLLANDCFG.lookup("logging.filename")),
                                   level=log_level)
        except IOError as exc:
            LOG.warning("Skipping file logging: %s", exc)
Example #4
0
def setup_config(opts):
    if not opts.quiet:
        debug = opts.log_level == 'debug'
        setup_console_logging(level=[logging.INFO,logging.DEBUG][debug])
    try:
        _setup_config(opts.config_file)
    except IOError, e:
        LOGGER.error("Failed to load holland config: %s", e)
        sys.exit(os.EX_CONFIG)
Example #5
0
def setup_config(opts):
    if not opts.quiet:
        debug = opts.log_level == 'debug'
        setup_console_logging(level=[logging.INFO, logging.DEBUG][debug])
    try:
        _setup_config(opts.config_file)
    except IOError as e:
        LOGGER.error("Failed to load holland config: %s", e)
        sys.exit(os.EX_CONFIG)
Example #6
0
def setup_config(opts):
    """
    Setup Config
    """
    if not opts.quiet:
        debug = opts.log_level == "debug"
        setup_console_logging(level=[logging.INFO, logging.DEBUG][debug])
    try:
        _setup_config(opts.config_file)
    except IOError as ex:
        LOG.error("Failed to load holland config: %s", ex)
        sys.exit(os.EX_CONFIG)
Example #7
0
def setup_config(opts):
    """
    Setup Config
    """
    if not opts.quiet:
        debug = opts.log_level == "debug"
        setup_console_logging(level=[logging.INFO, logging.DEBUG][debug])
    try:
        _setup_config(opts.config_file)
    except IOError as ex:
        LOG.error("Failed to load holland config: %s", ex)
        sys.exit(os.EX_CONFIG)
Example #8
0
def setup_logging(opts):
    clear_root_handlers()
    if hasattr(opts, "log_level"):
        log_level = opts.log_level or hollandcfg.lookup("logging.level")
    else:
        log_level = hollandcfg.lookup("logging.level")

    if os.isatty(sys.stdin.fileno()) and not opts.quiet:
        setup_console_logging(level=log_level)

    if hollandcfg.lookup("logging.filename"):
        try:
            setup_file_logging(filename=str(hollandcfg.lookup("logging.filename")), level=log_level)
        except IOError, exc:
            LOGGER.warn("Skipping file logging: %s", exc)
Example #9
0
def setup_logging(opts):
    clear_root_handlers()
    if hasattr(opts, 'log_level'):
        log_level = opts.log_level or hollandcfg.lookup('logging.level')
    else:
        log_level = hollandcfg.lookup('logging.level')

    if (not opts.quiet):
        setup_console_logging(level=log_level)

    if hollandcfg.lookup('logging.filename'):
        try:
            setup_file_logging(filename=str(hollandcfg.lookup('logging.filename')),
                               level=log_level)
        except IOError, exc:
            LOGGER.warn("Skipping file logging: %s", exc)
Example #10
0
def setup_logging(opts):
    clear_root_handlers()
    if hasattr(opts, 'log_level'):
        log_level = opts.log_level or hollandcfg.lookup('logging.level')
    else:
        log_level = hollandcfg.lookup('logging.level')

    if (not opts.quiet):
        setup_console_logging(level=log_level)

    if hollandcfg.lookup('logging.filename'):
        try:
            setup_file_logging(filename=str(
                hollandcfg.lookup('logging.filename')),
                               level=log_level)
        except IOError, exc:
            LOGGER.warn("Skipping file logging: %s", exc)
Example #11
0
def setup_logging(opts):
    clear_root_handlers()
    if hasattr(opts, 'log_level'):
        log_level = opts.log_level or hollandcfg.lookup('logging.level')
    else:
        log_level = hollandcfg.lookup('logging.level')

    if (os.isatty(sys.stdin.fileno()) and not opts.quiet):
        setup_console_logging(level=log_level)

    if hollandcfg.lookup('logging.filename'):
        setup_file_logging(filename=hollandcfg.lookup('logging.filename'),
                           level=log_level)

    # Monkey patch in routing warnings through logging
    old_showwarning = warnings.showwarning
    warnings.showwarning = log_warnings