當前位置: 首頁>>代碼示例>>Python>>正文


Python util.get_logger方法代碼示例

本文整理匯總了Python中multiprocessing.util.get_logger方法的典型用法代碼示例。如果您正苦於以下問題:Python util.get_logger方法的具體用法?Python util.get_logger怎麽用?Python util.get_logger使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在multiprocessing.util的用法示例。


在下文中一共展示了util.get_logger方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: get_logger

# 需要導入模塊: from multiprocessing import util [as 別名]
# 或者: from multiprocessing.util import get_logger [as 別名]
def get_logger():
    '''
    Return package logger -- if it does not already exist then it is created
    '''
    from multiprocessing.util import get_logger
    return get_logger() 
開發者ID:war-and-code,項目名稱:jawfish,代碼行數:8,代碼來源:__init__.py

示例2: prepare

# 需要導入模塊: from multiprocessing import util [as 別名]
# 或者: from multiprocessing.util import get_logger [as 別名]
def prepare(data):
    '''
    Try to get current process ready to unpickle process object
    '''
    if 'name' in data:
        process.current_process().name = data['name']

    if 'authkey' in data:
        process.current_process().authkey = data['authkey']

    if 'log_to_stderr' in data and data['log_to_stderr']:
        util.log_to_stderr()

    if 'log_level' in data:
        util.get_logger().setLevel(data['log_level'])

    if 'log_fmt' in data:
        import logging
        util.get_logger().handlers[0].setFormatter(
            logging.Formatter(data['log_fmt'])
        )

    if 'sys_path' in data:
        sys.path = data['sys_path']

    if 'sys_argv' in data:
        sys.argv = data['sys_argv']

    if 'dir' in data:
        os.chdir(data['dir'])

    if 'orig_dir' in data:
        process.ORIGINAL_DIR = data['orig_dir']

    if 'mp_tracker_args' in data:
        from multiprocessing.resource_tracker import (
            _resource_tracker as mp_resource_tracker
        )
        mp_resource_tracker._fd = data['mp_tracker_args']['fd']
        mp_resource_tracker._pid = data['mp_tracker_args']['pid']
    if 'tracker_args' in data:
        from .resource_tracker import _resource_tracker
        _resource_tracker._pid = data["tracker_args"]['pid']
        if sys.platform == 'win32':
            handle = data["tracker_args"]["fh"]
            _resource_tracker._fd = msvcrt.open_osfhandle(handle, 0)
        else:
            _resource_tracker._fd = data["tracker_args"]["fd"]

    if 'init_main_from_name' in data:
        _fixup_main_from_name(data['init_main_from_name'])
    elif 'init_main_from_path' in data:
        _fixup_main_from_path(data['init_main_from_path'])


# Multiprocessing module helpers to fix up the main module in
# spawned subprocesses 
開發者ID:joblib,項目名稱:loky,代碼行數:59,代碼來源:spawn.py


注:本文中的multiprocessing.util.get_logger方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。