Python logging.FATAL Examples

The following are 30 code examples for showing how to use logging.FATAL(). These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.

You may check out the related API usage on the sidebar.

You may also want to check out all available functions/classes of the module logging , or try the search function .

Example 1
Project: ungoogled-chromium   Author: Eloston   File: _common.py    License: BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def __call__(self, parser, namespace, value, option_string=None):
        if option_string in ('--verbose', '-v'):
            value = logging.DEBUG
        elif option_string in ('--quiet', '-q'):
            value = logging.ERROR
        else:
            levels = {
                'FATAL': logging.FATAL,
                'ERROR': logging.ERROR,
                'WARNING': logging.WARNING,
                'INFO': logging.INFO,
                'DEBUG': logging.DEBUG
            }
            value = levels[value]
        set_logging_level(value)


# Public methods 
Example 2
Project: ironpython2   Author: IronLanguages   File: test_logging.py    License: Apache License 2.0 6 votes vote down vote up
def test_nested_with_virtual_parent(self):
        # Logging levels when some parent does not exist yet.
        m = self.next_message

        INF = logging.getLogger("INF")
        GRANDCHILD = logging.getLogger("INF.BADPARENT.UNDEF")
        CHILD = logging.getLogger("INF.BADPARENT")
        INF.setLevel(logging.INFO)

        # These should log.
        GRANDCHILD.log(logging.FATAL, m())
        GRANDCHILD.info(m())
        CHILD.log(logging.FATAL, m())
        CHILD.info(m())

        # These should not log.
        GRANDCHILD.debug(m())
        CHILD.debug(m())

        self.assert_log_lines([
            ('INF.BADPARENT.UNDEF', 'CRITICAL', '1'),
            ('INF.BADPARENT.UNDEF', 'INFO', '2'),
            ('INF.BADPARENT', 'CRITICAL', '3'),
            ('INF.BADPARENT', 'INFO', '4'),
        ]) 
Example 3
Project: BinderFilter   Author: dxwu   File: test_logging.py    License: MIT License 6 votes vote down vote up
def test_nested_with_virtual_parent(self):
        # Logging levels when some parent does not exist yet.
        m = self.next_message

        INF = logging.getLogger("INF")
        GRANDCHILD = logging.getLogger("INF.BADPARENT.UNDEF")
        CHILD = logging.getLogger("INF.BADPARENT")
        INF.setLevel(logging.INFO)

        # These should log.
        GRANDCHILD.log(logging.FATAL, m())
        GRANDCHILD.info(m())
        CHILD.log(logging.FATAL, m())
        CHILD.info(m())

        # These should not log.
        GRANDCHILD.debug(m())
        CHILD.debug(m())

        self.assert_log_lines([
            ('INF.BADPARENT.UNDEF', 'CRITICAL', '1'),
            ('INF.BADPARENT.UNDEF', 'INFO', '2'),
            ('INF.BADPARENT', 'CRITICAL', '3'),
            ('INF.BADPARENT', 'INFO', '4'),
        ]) 
Example 4
Project: oss-ftp   Author: aliyun   File: test_logging.py    License: MIT License 6 votes vote down vote up
def test_nested_with_virtual_parent(self):
        # Logging levels when some parent does not exist yet.
        m = self.next_message

        INF = logging.getLogger("INF")
        GRANDCHILD = logging.getLogger("INF.BADPARENT.UNDEF")
        CHILD = logging.getLogger("INF.BADPARENT")
        INF.setLevel(logging.INFO)

        # These should log.
        GRANDCHILD.log(logging.FATAL, m())
        GRANDCHILD.info(m())
        CHILD.log(logging.FATAL, m())
        CHILD.info(m())

        # These should not log.
        GRANDCHILD.debug(m())
        CHILD.debug(m())

        self.assert_log_lines([
            ('INF.BADPARENT.UNDEF', 'CRITICAL', '1'),
            ('INF.BADPARENT.UNDEF', 'INFO', '2'),
            ('INF.BADPARENT', 'CRITICAL', '3'),
            ('INF.BADPARENT', 'INFO', '4'),
        ]) 
Example 5
Project: Fluid-Designer   Author: Microvellum   File: test_logging.py    License: GNU General Public License v3.0 6 votes vote down vote up
def test_nested_with_virtual_parent(self):
        # Logging levels when some parent does not exist yet.
        m = self.next_message

        INF = logging.getLogger("INF")
        GRANDCHILD = logging.getLogger("INF.BADPARENT.UNDEF")
        CHILD = logging.getLogger("INF.BADPARENT")
        INF.setLevel(logging.INFO)

        # These should log.
        GRANDCHILD.log(logging.FATAL, m())
        GRANDCHILD.info(m())
        CHILD.log(logging.FATAL, m())
        CHILD.info(m())

        # These should not log.
        GRANDCHILD.debug(m())
        CHILD.debug(m())

        self.assert_log_lines([
            ('INF.BADPARENT.UNDEF', 'CRITICAL', '1'),
            ('INF.BADPARENT.UNDEF', 'INFO', '2'),
            ('INF.BADPARENT', 'CRITICAL', '3'),
            ('INF.BADPARENT', 'INFO', '4'),
        ]) 
Example 6
Project: ARK   Author: baidu   File: log.py    License: MIT License 6 votes vote down vote up
def tlog(self, level, text, *args):
        """
        记录文本日志信息,较高级别的日志(FATAL)会被收集到总控统一存储以备后续追查。
        实际的文本日志组装和输出是由标准库\
         `logging — Logging facility for Python <https://docs.python.org/2.7/library/logging.html>`_\ 提供的

        :param int level: 日志级别,级别包括:DEBUG < INFO < WARNING < ERROR < CRITICAL
        :param obj text: 要输出的文本信息,通过python字符串的%语法可以获得类似c语言printf的效果
        :param args: 格式化字符串中占位符对应的变量值,如果变量是对象则打印成json
        :returns: 无返回
        :rtype: None
        """
        logger = logging.getLogger(self._log_name)
        texts, json_args = self._format_request(logger.getEffectiveLevel(), text, args)
        if len(json_args) > 0:
            logger.log(level, texts, *json_args)
        else:
            logger.log(level, texts) 
Example 7
Project: ARK   Author: baidu   File: log.py    License: MIT License 6 votes vote down vote up
def fatal(self, text, *args):
        """
        打印fatal日志

        :param obj text: 要输出的文本信息,通过python字符串的%语法可以获得类似c语言printf的效果
        :param args: 格式化字符串中占位符对应的变量值,如果变量是对象则打印成json
        :returns: 无返回
        :rtype: None
        """
        logger = logging.getLogger(self._log_name)
        texts, json_args = self._format_request(logger.getEffectiveLevel(), text, args)
        if sys.exc_info()[0] is None:
            ei = None
        else:
            ei = True
        if len(json_args) > 0:
            logger.log(logging.FATAL, texts, *json_args, exc_info=ei)
        else:
            logger.log(logging.FATAL, texts, exc_info=ei) 
Example 8
Project: ironpython3   Author: IronLanguages   File: test_logging.py    License: Apache License 2.0 6 votes vote down vote up
def test_nested_with_virtual_parent(self):
        # Logging levels when some parent does not exist yet.
        m = self.next_message

        INF = logging.getLogger("INF")
        GRANDCHILD = logging.getLogger("INF.BADPARENT.UNDEF")
        CHILD = logging.getLogger("INF.BADPARENT")
        INF.setLevel(logging.INFO)

        # These should log.
        GRANDCHILD.log(logging.FATAL, m())
        GRANDCHILD.info(m())
        CHILD.log(logging.FATAL, m())
        CHILD.info(m())

        # These should not log.
        GRANDCHILD.debug(m())
        CHILD.debug(m())

        self.assert_log_lines([
            ('INF.BADPARENT.UNDEF', 'CRITICAL', '1'),
            ('INF.BADPARENT.UNDEF', 'INFO', '2'),
            ('INF.BADPARENT', 'CRITICAL', '3'),
            ('INF.BADPARENT', 'INFO', '4'),
        ]) 
Example 9
Project: insights-core   Author: RedHatInsights   File: client.py    License: Apache License 2.0 6 votes vote down vote up
def get_console_handler(config):
    if config.silent:
        target_level = logging.FATAL
    elif config.verbose:
        target_level = logging.DEBUG
    elif config.net_debug:
        target_level = NETWORK
    elif config.quiet:
        target_level = logging.ERROR
    else:
        target_level = logging.INFO

    handler = logging.StreamHandler(sys.stdout)
    handler.setLevel(target_level)

    log_format = LOG_FORMAT if config.verbose else "%(message)s"
    handler.setFormatter(logging.Formatter(log_format))

    return handler 
Example 10
Project: gcblue   Author: gcblue   File: test_logging.py    License: BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def test_nested_with_virtual_parent(self):
        # Logging levels when some parent does not exist yet.
        m = self.next_message

        INF = logging.getLogger("INF")
        GRANDCHILD = logging.getLogger("INF.BADPARENT.UNDEF")
        CHILD = logging.getLogger("INF.BADPARENT")
        INF.setLevel(logging.INFO)

        # These should log.
        GRANDCHILD.log(logging.FATAL, m())
        GRANDCHILD.info(m())
        CHILD.log(logging.FATAL, m())
        CHILD.info(m())

        # These should not log.
        GRANDCHILD.debug(m())
        CHILD.debug(m())

        self.assert_log_lines([
            ('INF.BADPARENT.UNDEF', 'CRITICAL', '1'),
            ('INF.BADPARENT.UNDEF', 'INFO', '2'),
            ('INF.BADPARENT', 'CRITICAL', '3'),
            ('INF.BADPARENT', 'INFO', '4'),
        ]) 
Example 11
Project: scaleio-py   Author: swevm   File: im.py    License: Apache License 2.0 6 votes vote down vote up
def _get_log_level(level):
        """
        small static method to get logging level
        :param str level: string of the level e.g. "INFO"
        :returns logging.<LEVEL>: appropriate debug level
        """
        # default to DEBUG
        if level is None or level == "DEBUG":
            return logging.DEBUG

        level = level.upper()
        # Make debugging configurable
        if level == "INFO":
            return logging.INFO
        elif level == "WARNING":
            return logging.WARNING
        elif level == "CRITICAL":
            return logging.CRITICAL
        elif level == "ERROR":
            return logging.ERROR
        elif level == "FATAL":
            return logging.FATAL
        else:
            raise Exception("UnknownLogLevelException: enter a valid log level") 
Example 12
Project: abseil-py   Author: abseil   File: __init__.py    License: Apache License 2.0 6 votes vote down vote up
def set_stderrthreshold(s):
  """Sets the stderr threshold to the value passed in.

  Args:
    s: str|int, valid strings values are case-insensitive 'debug',
        'info', 'warning', 'error', and 'fatal'; valid integer values are
        logging.DEBUG|INFO|WARNING|ERROR|FATAL.

  Raises:
      ValueError: Raised when s is an invalid value.
  """
  if s in converter.ABSL_LEVELS:
    FLAGS.stderrthreshold = converter.ABSL_LEVELS[s]
  elif isinstance(s, str) and s.upper() in converter.ABSL_NAMES:
    FLAGS.stderrthreshold = s
  else:
    raise ValueError(
        'set_stderrthreshold only accepts integer absl logging level '
        'from -3 to 1, or case-insensitive string values '
        "'debug', 'info', 'warning', 'error', and 'fatal'. "
        'But found "{}" ({}).'.format(s, type(s))) 
Example 13
Project: abseil-py   Author: abseil   File: __init__.py    License: Apache License 2.0 6 votes vote down vote up
def log(self, level, msg, *args, **kwargs):
    """Logs a message at a cetain level substituting in the supplied arguments.

    This method behaves differently in python and c++ modes.

    Args:
      level: int, the standard logging level at which to log the message.
      msg: str, the text of the message to log.
      *args: The arguments to substitute in the message.
      **kwargs: The keyword arguments to substitute in the message.
    """
    if level >= logging.FATAL:
      # Add property to the LogRecord created by this logger.
      # This will be used by the ABSLHandler to determine whether it should
      # treat CRITICAL/FATAL logs as really FATAL.
      extra = kwargs.setdefault('extra', {})
      extra[_ABSL_LOG_FATAL] = True
    super(ABSLLogger, self).log(level, msg, *args, **kwargs) 
Example 14
Project: abseil-py   Author: abseil   File: converter_test.py    License: Apache License 2.0 6 votes vote down vote up
def test_standard_to_absl(self):
    self.assertEqual(
        absl_logging.DEBUG, converter.standard_to_absl(logging.DEBUG))
    self.assertEqual(
        absl_logging.INFO, converter.standard_to_absl(logging.INFO))
    self.assertEqual(
        absl_logging.WARN, converter.standard_to_absl(logging.WARN))
    self.assertEqual(
        absl_logging.WARN, converter.standard_to_absl(logging.WARNING))
    self.assertEqual(
        absl_logging.ERROR, converter.standard_to_absl(logging.ERROR))
    self.assertEqual(
        absl_logging.FATAL, converter.standard_to_absl(logging.FATAL))
    self.assertEqual(
        absl_logging.FATAL, converter.standard_to_absl(logging.CRITICAL))
    # vlog levels.
    self.assertEqual(2, converter.standard_to_absl(logging.DEBUG - 1))
    self.assertEqual(3, converter.standard_to_absl(logging.DEBUG - 2))

    with self.assertRaises(TypeError):
      converter.standard_to_absl('') 
Example 15
def test_nested_with_virtual_parent(self):
        # Logging levels when some parent does not exist yet.
        m = self.next_message

        INF = logging.getLogger("INF")
        GRANDCHILD = logging.getLogger("INF.BADPARENT.UNDEF")
        CHILD = logging.getLogger("INF.BADPARENT")
        INF.setLevel(logging.INFO)

        # These should log.
        GRANDCHILD.log(logging.FATAL, m())
        GRANDCHILD.info(m())
        CHILD.log(logging.FATAL, m())
        CHILD.info(m())

        # These should not log.
        GRANDCHILD.debug(m())
        CHILD.debug(m())

        self.assert_log_lines([
            ('INF.BADPARENT.UNDEF', 'CRITICAL', '1'),
            ('INF.BADPARENT.UNDEF', 'INFO', '2'),
            ('INF.BADPARENT', 'CRITICAL', '3'),
            ('INF.BADPARENT', 'INFO', '4'),
        ]) 
Example 16
Project: pytest-logger   Author: aurzenligl   File: plugin.py    License: MIT License 6 votes vote down vote up
def _late_addoptions(parser, logcfg):
    """Add options to control logger"""
    parser.addini(
        name='logger_logsdir',
        help='base directory with log files for file loggers [basetemp]',
        default=None,
    )
    group = parser.getgroup('logger')
    group.addoption('--logger-logsdir',
                    help='pick you own logs directory instead of default '
                         'directory under session tmpdir')

    if logcfg._enabled:
        parser = _log_option_parser(logcfg._loggers)
        group.addoption('--loggers',
                        default=parser(logcfg._log_option_default),
                        type=parser,
                        metavar='LOGGER,LOGGER.LEVEL,...',
                        help='comma delimited list of loggers optionally suffixed with level '
                             'preceded by a dot. Levels can be lower or uppercase, or numeric. '
                             'For example: "logger1,logger2.info,logger3.FATAL,logger4.25"') 
Example 17
Project: CDSS   Author: HealthRex   File: STARROrderMedConversion.py    License: GNU General Public License v3.0 6 votes vote down vote up
def main(self, argv):
        """Main method, callable from command line"""
        log.setLevel(logging.FATAL)

        usage_str = "usage: %prog [options]\n"
        parser = OptionParser(usage=usage_str)
        parser.add_option("-s", "--startDate", dest="startDate", metavar="<startDate>",  help="Date string (e.g., 2011-12-15), if provided, will only run conversion on items with ordering time on or after this date.")
        parser.add_option("-e", "--endDate", dest="endDate", metavar="<endDate>",  help="Date string (e.g., 2011-12-15), if provided, will only run conversion on items with ordering time before this date.")
        parser.add_option("-n", "--normalizeMixtures", dest="normalizeMixtures", action="store_true",  help="If set, when find medication mixtures, will unravel / normalize into separate entries, one for each ingredient")
        parser.add_option("-d", "--doseCountLimit", dest="doseCountLimit", help="Medication orders with a finite number of doses specified less than this limit will be labeled as different items than those without a number specified, or whose number is >= to this limit. Intended to distinguish things like IV single bolus / use vs. continuous infusions and standing medication orders")
        (options, args) = parser.parse_args(argv[1:])

        log.info("Starting: " + str.join(" ", argv))
        timer = time.time()

        conv_options = ConversionOptions()
        conv_options.extract_parser_options(options)

        self.convertAndUpload(conv_options)

        timer = time.time() - timer
        log.info("%.3f seconds to complete", timer) 
Example 18
Project: CTFCrackTools-V2   Author: Acmesec   File: test_logging.py    License: GNU General Public License v3.0 6 votes vote down vote up
def test_nested_with_virtual_parent(self):
        # Logging levels when some parent does not exist yet.
        m = self.next_message

        INF = logging.getLogger("INF")
        GRANDCHILD = logging.getLogger("INF.BADPARENT.UNDEF")
        CHILD = logging.getLogger("INF.BADPARENT")
        INF.setLevel(logging.INFO)

        # These should log.
        GRANDCHILD.log(logging.FATAL, m())
        GRANDCHILD.info(m())
        CHILD.log(logging.FATAL, m())
        CHILD.info(m())

        # These should not log.
        GRANDCHILD.debug(m())
        CHILD.debug(m())

        self.assert_log_lines([
            ('INF.BADPARENT.UNDEF', 'CRITICAL', '1'),
            ('INF.BADPARENT.UNDEF', 'INFO', '2'),
            ('INF.BADPARENT', 'CRITICAL', '3'),
            ('INF.BADPARENT', 'INFO', '4'),
        ]) 
Example 19
Project: pyexperiment   Author: duerrp   File: test_logger.py    License: MIT License 6 votes vote down vote up
def test_print_timings_prints(self):
        """Test timing code and printing really prints a message
        """
        buf = io.StringIO()

        # Nothing should be logged yet
        self.assertEqual(len(self.log_stream.getvalue()), 0)

        log.initialize()
        # Still, nothing should be logged yet
        self.assertEqual(len(self.log_stream.getvalue()), 0)

        with log.timed(level=logging.FATAL):
            _ = 1 + 1

        with stdout_redirector(buf):
            log.print_timings()

        # Something should be printed
        self.assertNotEqual(len(buf.getvalue()), 0)

        log.close()
        # Something should be logged
        self.assertNotEqual(len(self.log_stream.getvalue()), 0) 
Example 20
Project: kopf   Author: zalando-incubator   File: logging.py    License: MIT License 6 votes vote down vote up
def emit(self, record: logging.LogRecord) -> None:
        # Same try-except as in e.g. `logging.StreamHandler`.
        try:
            ref = getattr(record, 'k8s_ref')
            type = (
                "Debug" if record.levelno <= logging.DEBUG else
                "Normal" if record.levelno <= logging.INFO else
                "Warning" if record.levelno <= logging.WARNING else
                "Error" if record.levelno <= logging.ERROR else
                "Fatal" if record.levelno <= logging.FATAL else
                logging.getLevelName(record.levelno).capitalize())
            reason = 'Logging'
            message = self.format(record)
            posting.enqueue(
                ref=ref,
                type=type,
                reason=reason,
                message=message)
        except Exception:
            self.handleError(record) 
Example 21
Project: CTFCrackTools   Author: Acmesec   File: test_logging.py    License: GNU General Public License v3.0 6 votes vote down vote up
def test_nested_with_virtual_parent(self):
        # Logging levels when some parent does not exist yet.
        m = self.next_message

        INF = logging.getLogger("INF")
        GRANDCHILD = logging.getLogger("INF.BADPARENT.UNDEF")
        CHILD = logging.getLogger("INF.BADPARENT")
        INF.setLevel(logging.INFO)

        # These should log.
        GRANDCHILD.log(logging.FATAL, m())
        GRANDCHILD.info(m())
        CHILD.log(logging.FATAL, m())
        CHILD.info(m())

        # These should not log.
        GRANDCHILD.debug(m())
        CHILD.debug(m())

        self.assert_log_lines([
            ('INF.BADPARENT.UNDEF', 'CRITICAL', '1'),
            ('INF.BADPARENT.UNDEF', 'INFO', '2'),
            ('INF.BADPARENT', 'CRITICAL', '3'),
            ('INF.BADPARENT', 'INFO', '4'),
        ]) 
Example 22
Project: SalesforcePy   Author: forcedotcom   File: sfdc.py    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        """ Constructor.

            :Parameters:
                - `*username` (`string`) - Salesforce username.
                - `*password` (`string`) - Salesforce password.
                - `*login_url` (`string`) - Salesforce login URL.
                - `*client_id` (`string`) - Salesforce client ID.
                - `*client_secret` (`string`) - Salesforce client secret.
                - `\**kwargs` - kwargs (see below)

            :Keyword Arguments:
                * *protocol* (`string`) --
                    Protocol (future use)
                * *proxies* (`dict`) --
                    A dict containing proxies to be used by `requests` module. Ex:
                        `{"https": "example.org:443"}`
                    Default: `None`
                * *version* (`string`) --
                   SFDC API version to use e.g. '39.0'
        """

        self.username = args[0]
        self.password = args[1]
        self.client_id = args[2]
        self.client_secret = args[3]
        self.protocol = kwargs.get('protocol')
        self.proxies = kwargs.get('proxies')
        self.instance_url = None
        self.logger = logging.getLogger('sfdc_py')
        self.logger.setLevel(logging.FATAL)
        self.logger.addHandler(logging.StreamHandler())
        self.client_api_version = None
        self.client_kwargs = kwargs
        self.session_id = None
        self.chatter = chatter.Chatter(self)
        self.jobs = jobs.Jobs(self)
        self.wave = wave.Wave(self) 
Example 23
Project: stem   Author: torproject   File: log.py    License: GNU Lesser General Public License v3.0 5 votes vote down vote up
def __init__(self) -> None:
    logging.Handler.__init__(self, level = logging.FATAL + 5)  # disable logging 
Example 24
Project: stem   Author: torproject   File: log.py    License: GNU Lesser General Public License v3.0 5 votes vote down vote up
def logging_level(runlevel: 'stem.util.log.Runlevel') -> int:
  """
  Translates a runlevel into the value expected by the logging module.

  :param runlevel: runlevel to be returned, no logging if **None**
  """

  if runlevel:
    return LOG_VALUES[runlevel]
  else:
    return logging.FATAL + 5 
Example 25
Project: ungoogled-chromium   Author: Eloston   File: _common.py    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def add_common_params(parser):
    """
    Adds common command line arguments to a parser.
    """

    # Logging levels
    logging_group = parser.add_mutually_exclusive_group()
    logging_group.add_argument(
        '--log-level',
        action=SetLogLevel,
        choices=['FATAL', 'ERROR', 'WARNING', 'INFO', 'DEBUG'],
        help="Set logging level of current script. Only one of 'log-level', 'verbose',"
        " 'quiet' can be set at a time.")
    logging_group.add_argument(
        '--quiet',
        '-q',
        action=SetLogLevel,
        nargs=0,
        help="Display less outputs to console. Only one of 'log-level', 'verbose',"
        " 'quiet' can be set at a time.")
    logging_group.add_argument(
        '--verbose',
        '-v',
        action=SetLogLevel,
        nargs=0,
        help="Increase logging verbosity to include DEBUG messages. Only one of "
        "'log-level', 'verbose', 'quiet' can be set at a time.") 
Example 26
Project: pledgeservice   Author: MayOneUS   File: http.py    License: Apache License 2.0 5 votes vote down vote up
def shutdown(self):
        """Shutdown the server"""
        # avoid showing traceback related to asyncore
        self.was_shutdown = True
        self.logger.setLevel(logging.FATAL)
        while self._map:
            triggers = list(self._map.values())
            for trigger in triggers:
                trigger.handle_close()
        self.maintenance(0)
        self.task_dispatcher.shutdown()
        return True 
Example 27
Project: aws-config-to-elasticsearch   Author: awslabs   File: configservice_util.py    License: Apache License 2.0 5 votes vote down vote up
def __init__(self, region, verbose_log=None):
        self.region = region

        self.config_conn = boto3.client('config', region_name=region)

        if verbose_log is None:
            self.verbose_log = logging.getLogger("configService")
            self.verbose_log.setLevel(level=logging.FATAL)
        else:
            self.verbose_log = verbose_log 
Example 28
Project: oss-ftp   Author: aliyun   File: log.py    License: MIT License 5 votes vote down vote up
def fatal(self, msg, *args, **kw):
        self.log(self.FATAL, msg, *args, **kw) 
Example 29
Project: cloudflare-ip-ping   Author: olixu   File: pingip.py    License: Apache License 2.0 5 votes vote down vote up
def set_logging_format():
    logging.basicConfig(level=logging.INFO,
        format='%(message)s',
        filename="ping_host.log",
        filemode='w'
    )
    console = logging.StreamHandler()
    console.setLevel(logging.FATAL)
    formatter = logging.Formatter('%(message)s')
    console.setFormatter(formatter)
    logging.getLogger('').addHandler(console)

# 获得所有待测试ip 
Example 30
Project: FAI-PEP   Author: facebook   File: get_connected_devices.py    License: Apache License 2.0 5 votes vote down vote up
def __init__(self, **kwargs):
        getLogger().setLevel(logging.FATAL)
        raw_args = kwargs.get("raw_args", None)
        self.args, self.unknowns = parser.parse_known_args(raw_args)