当前位置: 首页>>代码示例>>Python>>正文


Python config.dictConfig方法代码示例

本文整理汇总了Python中logging.config.dictConfig方法的典型用法代码示例。如果您正苦于以下问题:Python config.dictConfig方法的具体用法?Python config.dictConfig怎么用?Python config.dictConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在logging.config的用法示例。


在下文中一共展示了config.dictConfig方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setup_logging

# 需要导入模块: from logging import config [as 别名]
# 或者: from logging.config import dictConfig [as 别名]
def setup_logging(filename):
    """Setup logging based on a json string.

    :type filename: str
    :param filename: Log configuration file.
    :raises: IOError -- If the file does not exist.
    :raises: ValueError -- If the file is an invalid json file.
    """
    try:
        config = parse_json_file(filename)
        log_conf.dictConfig(config)
        logpy4j = logging.getLogger("py4j")
        logpy4j.setLevel(logging.ERROR)
        logkafka = logging.getLogger("kafka")
        logkafka.setLevel(logging.ERROR)
    except (IOError, ValueError):
        raise 
开发者ID:openstack,项目名称:monasca-analytics,代码行数:19,代码来源:common_util.py

示例2: logger

# 需要导入模块: from logging import config [as 别名]
# 或者: from logging.config import dictConfig [as 别名]
def logger():
    log_conf.dictConfig(log_config)

    return logging.getLogger(config.LOG_LEVEL) 
开发者ID:alexknight,项目名称:TraceAnalysis,代码行数:6,代码来源:log.py

示例3: configure

# 需要导入模块: from logging import config [as 别名]
# 或者: from logging.config import dictConfig [as 别名]
def configure(name, extras=None):
  """Set logger. See the list of loggers in bot/config/logging.yaml.
  Also configures the process to log any uncaught exceptions as an error.
  |extras| will be included by emit() in log messages."""
  suppress_unwanted_warnings()

  if _is_running_on_app_engine():
    configure_appengine()
    return

  if _console_logging_enabled():
    logging.basicConfig()
  else:
    config.dictConfig(get_logging_config_dict(name))

  logger = logging.getLogger(name)
  logger.setLevel(logging.INFO)
  set_logger(logger)

  # Set _default_extras so they can be used later.
  if extras is None:
    extras = {}
  global _default_extras
  _default_extras = extras

  # Install an exception handler that will log an error when there is an
  # uncaught exception.
  sys.excepthook = uncaught_exception_handler 
开发者ID:google,项目名称:clusterfuzz,代码行数:30,代码来源:logs.py

示例4: setup_logging

# 需要导入模块: from logging import config [as 别名]
# 或者: from logging.config import dictConfig [as 别名]
def setup_logging(filename):
    """Setup logging based on a json string."""
    with open(filename, "rt") as f:
        config = json.load(f)

    log_conf.dictConfig(config) 
开发者ID:openstack,项目名称:monasca-analytics,代码行数:8,代码来源:run.py

示例5: setup_logging

# 需要导入模块: from logging import config [as 别名]
# 或者: from logging.config import dictConfig [as 别名]
def setup_logging():
    current_dir = os.path.dirname(__file__)
    logging_config_file = os.path.join(current_dir,
                                       DEFAULT_LOGGING_CONFIG_FILE)
    with open(logging_config_file, "rt") as f:
        config = json.load(f)
    log_conf.dictConfig(config) 
开发者ID:openstack,项目名称:monasca-analytics,代码行数:9,代码来源:config_dsl.py

示例6: reset_logging

# 需要导入模块: from logging import config [as 别名]
# 或者: from logging.config import dictConfig [as 别名]
def reset_logging():
    """Reset the logging to reflect the current configuration.

    This is commonly called after updating the logging configuration to let the changes take affect.
    """
    logging_config.dictConfig(get_logging_configuration_dict()) 
开发者ID:robbert-harms,项目名称:MDT,代码行数:8,代码来源:__init__.py

示例7: setup_logging

# 需要导入模块: from logging import config [as 别名]
# 或者: from logging.config import dictConfig [as 别名]
def setup_logging(disable_existing_loggers=None):
    """Setup global logging.

    This uses the loaded config settings to set up the logging.

    Args:
        disable_existing_loggers (boolean): If we would like to disable the existing loggers when creating this one.
            None means use the default from the config, True and False overwrite the config.
    """
    conf = get_logging_configuration_dict()
    if disable_existing_loggers is not None:
        conf['disable_existing_loggers'] = True
    logging_config.dictConfig(conf) 
开发者ID:robbert-harms,项目名称:MDT,代码行数:15,代码来源:utils.py

示例8: setup_logging

# 需要导入模块: from logging import config [as 别名]
# 或者: from logging.config import dictConfig [as 别名]
def setup_logging():
    with open(config.logging_yaml) as f:
        logging_config.dictConfig(yaml.safe_load(f.read())) 
开发者ID:pilgun,项目名称:acvtool,代码行数:5,代码来源:acvtool.py

示例9: emit

# 需要导入模块: from logging import config [as 别名]
# 或者: from logging.config import dictConfig [as 别名]
def emit(self, record):
            pass

# Make sure that dictConfig is available
# This was added in Python 2.7/3.2 
开发者ID:blackye,项目名称:luscan-devel,代码行数:7,代码来源:log.py

示例10: run

# 需要导入模块: from logging import config [as 别名]
# 或者: from logging.config import dictConfig [as 别名]
def run():
    """Start wechat client."""
    config.dictConfig(LOGGING)
    client_log = getLogger('client')

    session = Session()
    client = SyncClient(session)
    sync_session(client)

    client_log.info('process down...') 
开发者ID:justdoit0823,项目名称:pywxclient,代码行数:12,代码来源:client.py

示例11: run

# 需要导入模块: from logging import config [as 别名]
# 或者: from logging.config import dictConfig [as 别名]
def run(**kwargs):
    """Start wechat client."""
    input_queue = queue.Queue()
    msg_queue = queue.Queue()
    login_event = threading.Event()
    exit_event = threading.Event()

    config.dictConfig(LOGGING)
    client_log = getLogger('client')

    session = Session()
    client = SyncClient(session)
    session_thread = threading.Thread(
        target=sync_session,
        args=(client, input_queue, login_event, exit_event))
    reply_thread = threading.Thread(
        target=reply_message,
        args=(client, msg_queue, login_event, exit_event))

    session_thread.start()
    reply_thread.start()

    show_input_message(client, input_queue, msg_queue, exit_event)

    session_thread.join()
    reply_thread.join()

    client_log.info('process down...') 
开发者ID:justdoit0823,项目名称:pywxclient,代码行数:30,代码来源:thread_client.py

示例12: __init__

# 需要导入模块: from logging import config [as 别名]
# 或者: from logging.config import dictConfig [as 别名]
def __init__(self, system, logDefs = None):
        super(ActorSystemBase, self).__init__()
        self.system = system
        self._pendingSends = []
        if logDefs is not False: dictConfig(logDefs or defaultLoggingConfig)
        self._primaryActors = []
        self._primaryCount  = 0
        self._globalNames = {}
        self.procLimit = 0
        self._sources = {}  # key = sourcehash, value = encrypted zipfile data
        self._sourceAuthority = None  # ActorAddress of Source Authority
        self._sourceNotifications = [] # list of actor addresses to notify of loads
        asys = self._newRefAndActor(system, system.systemAddress,
                                    system.systemAddress,
                                    External)
        extreq = self._newRefAndActor(system, system.systemAddress,
                                      ActorAddress('System:ExternalRequester'),
                                      External)
        badActor = self._newRefAndActor(system, system.systemAddress,
                                        ActorAddress('System:BadActor'), BadActor)
        self.actorRegistry = {  # key=ActorAddress string, value=ActorRef
            system.systemAddress.actorAddressString: asys,
            'System:ExternalRequester': extreq,
            'System:BadActor': badActor,
        }
        self._internalAddresses = list(self.actorRegistry.keys())
        self._private_lock = threading.RLock()
        self._private_count = 0

        system.capabilities['Python Version'] = tuple(sys.version_info)
        system.capabilities['Thespian Generation'] = ThespianGeneration
        system.capabilities['Thespian Version'] = str(int(time.time()*1000))
        system.capabilities['Thespian ActorSystem Name'] = 'simpleSystem'
        system.capabilities['Thespian ActorSystem Version'] = 2
        system.capabilities['Thespian Watch Supported'] = False
        system.capabilities['AllowRemoteActorSources'] = 'No' 
开发者ID:thespianpy,项目名称:Thespian,代码行数:38,代码来源:simpleSystemBase.py


注:本文中的logging.config.dictConfig方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。