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


Python Log.logger方法代码示例

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


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

示例1: save

# 需要导入模块: from echomesh.util import Log [as 别名]
# 或者: from echomesh.util.Log import logger [as 别名]
    def save(self):
        saved_files = []
        for f, settings in self.file_settings:
            if len(settings) > 2 and settings[2]:
                saved_files.append(f)
                settings[1] = Merge.merge(*settings[1:])
                while len(settings) > 2:
                    settings.pop()
                if os.path.exists(f):
                    with open(f, 'r') as fo:
                        data = fo.read().split(Yaml.SEPARATOR)[0]
                else:
                    data = ''

                parent = os.path.dirname(f)
                if not os.path.exists(parent):
                    from echomesh.util import Log
                    Log.logger(__name__).info('Creating directory %s.', parent)
                    os.makedirs(parent)

                with open(f, 'wb') as fw:
                    if data:
                        fw.write(data)
                        fw.write(Yaml.SEPARATOR)
                    fw.write(Yaml.encode_one(settings[1]))

        self.arg_settings = Merge.difference_strict(
            self.arg_settings, self.changed)
        self.recalculate()
        return saved_files
开发者ID:TopRamenGod,项目名称:echomesh,代码行数:32,代码来源:MergeSettings.py

示例2: main

# 需要导入模块: from echomesh.util import Log [as 别名]
# 或者: from echomesh.util.Log import logger [as 别名]
def main():
  import sys

  times = []

  def p(msg=''):
    """Print progress messages while echomesh loads."""
    print(msg, end='\n' if msg else '')
    global COUNT
    dot = str(COUNT % 10) if USE_DIGITS_FOR_PROGRESS_BAR else '.'
    print(dot, end='')
    COUNT += 1

    sys.stdout.flush()

    import time
    times.append(time.time())

  p('Loading echomesh ')

  from echomesh.base import Path
  p()

  Path.fix_sys_path()
  p()

  from echomesh.base import Args
  p()

  Args.set_arguments(sys.argv)
  p()

  from echomesh.base import Config
  p()

  Config.recalculate()
  p()

  if Config.get('autostart') and not Config.get('permission', 'autostart'):
    print()
    from echomesh.util import Log
    Log.logger(__name__).info("Not autostarting because autostart=False")
    exit(0)
  p()

  from echomesh import Instance
  print()

  if Config.get('diagnostics', 'startup_times'):
    print()
    for i in range(len(times) - 1):
      print(i, ':', int(1000 * (times[i + 1] - times[i])))
    print()

  Instance.main()

  if Config.get('diagnostics', 'unused_configs'):
    import yaml
    print(yaml.safe_dump(Config.get_unvisited()))
开发者ID:dasbavaria,项目名称:echomesh,代码行数:61,代码来源:Main.py

示例3: _load_library

# 需要导入模块: from echomesh.util import Log [as 别名]
# 或者: from echomesh.util.Log import logger [as 别名]
def _load_library(name):
  """Try to load a shared library, report an error on failure."""
  try:
    import ctypes
    return ctypes.CDLL('lib%s.so' % name)
  except:
    from echomesh.util import Log
    Log.logger(__name__).error("Couldn't load library %s" % name)
开发者ID:Arexxk,项目名称:pi3d,代码行数:10,代码来源:__init__.py

示例4: _help

# 需要导入模块: from echomesh.util import Log [as 别名]
# 或者: from echomesh.util.Log import logger [as 别名]
from __future__ import absolute_import, division, print_function, unicode_literals

from echomesh.command import Registry
from echomesh.command import Show

from echomesh.util import Log

LOGGER = Log.logger(__name__)

HELP = """
echomesh has the following help topics:

  %s

Type "help TOPIC" for more information - for example, "help quit" or "help run".
"""

def _help(_, *parts):
    if not parts:
        LOGGER.info(HELP, Registry.registry().join_keys(command_only=False))
    else:
        cmd, parts = parts[0], parts[1:]
        if not parts:
            help_text = Registry.registry().get_help(cmd)
            LOGGER.info(help_text or ('No help text available for "%s"' % cmd))
        elif cmd == 'show':
            sub = parts[0]
            help_text = Show.SHOW_REGISTRY.get_help(sub)
            LOGGER.info('\nshow %s:', sub)
            LOGGER.info(help_text or
                        ('No help text available for "show %s"' % sub))
开发者ID:TopRamenGod,项目名称:echomesh,代码行数:33,代码来源:Help.py

示例5: _main

# 需要导入模块: from echomesh.util import Log [as 别名]
# 或者: from echomesh.util.Log import logger [as 别名]
def _main():
    import sys

    times = []

    def p(msg=''):
        """Print progress messages while echomesh loads."""
        print(msg, end='\n' if msg else '')
        global COUNT
        dot = str(COUNT % 10) if USE_DIGITS_FOR_PROGRESS_BAR else '.'
        print(dot, end='')
        COUNT += 1

        sys.stdout.flush()

        import time
        times.append(time.time())

    p('Loading echomesh ')

    from echomesh.base import Version
    if Version.TOO_NEW:
        print(Version.ERROR)

    from echomesh.base import Path
    if not Path.project_path():
        return
    p()

    Path.fix_home_directory_environment_variable()
    p()

    Path.fix_sys_path()
    p()

    from echomesh.base import Settings
    p()

    Settings.read_settings(sys.argv[1:])
    p()

    if Settings.get('execution', 'autostart') and not Settings.get(
            'permission', 'autostart'):
        print()
        from echomesh.util import Log
        Log.logger(__name__).info('No permission to autostart')
        return
    p()

    from echomesh.base import Quit
    p()

    Quit.register_atexit(Settings.save)
    p()

    from echomesh.Instance import Instance
    p()

    instance = Instance()
    print()
    p()

    if Settings.get('diagnostics', 'startup_times'):
        print()
        for i in range(len(times) - 1):
            print(i, ':', int(1000 * (times[i + 1] - times[i])))
        print()

    instance.main()
开发者ID:TopRamenGod,项目名称:echomesh,代码行数:71,代码来源:Main.py


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