• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python logger.log函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pythonbrew.log.logger.log函数的典型用法代码示例。如果您正苦于以下问题:Python log函数的具体用法?Python log怎么用?Python log使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: install_pythonbrew

def install_pythonbrew():
    PythonbrewInstaller.install(INSTALLER_ROOT)
    # for bash
    shrc = yourshrc = "bashrc"
    logger.log(
        """
Well-done! Congratulations!

The pythonbrew is installed as:
    
  %(ROOT)s

Please add the following line to the end of your ~/.%(yourshrc)s

  [[ -s "%(PATH_ETC)s/%(shrc)s" ]] && source "%(PATH_ETC)s/%(shrc)s"

After that, exit this shell, start a new one, and install some fresh
pythons:

  pythonbrew install 2.7.2
  pythonbrew install 3.2

For further instructions, run:

  pythonbrew help

The default help messages will popup and tell you what to do!

Enjoy pythonbrew at %(ROOT)s!!
"""
        % {"ROOT": ROOT, "yourshrc": yourshrc, "shrc": shrc, "PATH_ETC": PATH_ETC.replace(os.getenv("HOME"), "$HOME")}
    )
开发者ID:hrother,项目名称:pythonbrew,代码行数:32,代码来源:__init__.py


示例2: install_setuptools

    def install_setuptools(self):
        options = self.options
        pkgname = self.pkg.name
        if options.no_setuptools:
            logger.log("Skip installation of setuptools.")
            return
        download_url = DISTRIBUTE_SETUP_DLSITE
        filename = Link(download_url).filename
        download_file = os.path.join(PATH_DISTS, filename)

        dl = Downloader()
        dl.download(filename, download_url, download_file)

        install_dir = os.path.join(PATH_PYTHONS, pkgname)
        path_python = os.path.join(install_dir,"bin","python")
        try:
            s = Subprocess(log=self.logfile, cwd=PATH_DISTS, verbose=self.options.verbose)
            logger.info("Installing distribute into %s" % install_dir)
            s.check_call([path_python, filename])
            # installing pip
            easy_install = os.path.join(install_dir, 'bin', 'easy_install')
            if os.path.isfile(easy_install):
                logger.info("Installing pip into %s" % install_dir)
                s.check_call([easy_install, 'pip'])
        except:
            logger.error("Failed to install setuptools. See %s/build.log to see why." % (ROOT))
            logger.log("Skip installation of setuptools.")
开发者ID:Ank1tAggarwal,项目名称:pythonbrew,代码行数:27,代码来源:pythoninstaller.py


示例3: install_pythonbrew

def install_pythonbrew():
    PythonbrewInstaller.install(INSTALLER_ROOT)
    # for bash
    shrc = yourshrc = "bashrc"
    logger.log("""
Well-done! Congratulations!

The pythonbrew is installed as:
    
  %(ROOT)s

Please add the following line to the end of your ~/.%(yourshrc)s

  source %(PATH_ETC)s/%(shrc)s

After that, exit this shell, start a new one, and install some fresh
pythons:

  pythonbrew install 2.7.2
  pythonbrew install 3.2

For further instructions, run:

  pythonbrew help

The default help messages will popup and tell you what to do!

Enjoy pythonbrew at %(ROOT)s!!
""" % {'ROOT':ROOT, 'yourshrc':yourshrc, 'shrc':shrc, 'PATH_ETC':PATH_ETC})
开发者ID:Ank1tAggarwal,项目名称:pythonbrew,代码行数:29,代码来源:__init__.py


示例4: systemwide_pythonbrew

def systemwide_pythonbrew():
    PythonbrewInstaller.install(INSTALLER_ROOT)
    PythonbrewInstaller.systemwide_install()
    logger.log(
        """
Well-done! Congratulations!

The pythonbrew is installed as:
    
  %(ROOT)s

After that, exit this shell, start a new one, and install some fresh
pythons:

  pythonbrew install 2.7.2
  pythonbrew install 3.2

For further instructions, run:

  pythonbrew help

The default help messages will popup and tell you what to do!

Enjoy pythonbrew at %(ROOT)s!!
"""
        % {"ROOT": ROOT}
    )
开发者ID:hrother,项目名称:pythonbrew,代码行数:27,代码来源:__init__.py


示例5: configure

 def configure(self):
     s = Subprocess(log=self.logfile, cwd=self.build_dir, verbose=self.options.verbose)
     cmd = "./configure --prefix=%s %s %s" % (
         self.install_dir,
         self.options.configure,
         " ".join(self.configure_options),
     )
     if self.options.verbose:
         logger.log(cmd)
     s.check_call(cmd)
开发者ID:steakknife,项目名称:pythonbrew,代码行数:10,代码来源:pythoninstaller.py


示例6: run_command_print_activate

 def run_command_print_activate(self, options, args):
     if len(args) < 2:
         logger.error("Unrecognized command line argument: ( 'pythonbrew venv print_activate <project>' )")
         sys.exit(1)
     
     activate = os.path.join(self._workon_home, args[1], 'bin', 'activate')
     if not os.path.exists(activate):
         logger.error('`%s` environment already does not exist. Try `pythonbrew venv create %s`.' % (args[1], args[1]))
         sys.exit(1)
         
     logger.log(activate)
开发者ID:ampledata,项目名称:pythonbrew,代码行数:11,代码来源:venv.py


示例7: shell

 def shell(self, cmd):
     if self._debug:
         logger.log(cmd)
     if is_sequence(cmd):
         cmd = "".join(cmd)
     if self._log:
         if self._verbose:
             cmd = "(%s) 2>&1 | tee '%s'" % (cmd, self._log)
         else:
             cmd = "(%s) >> '%s' 2>&1" % (cmd, self._log)
     returncode = subprocess.call(cmd, shell=True, cwd=self._cwd)
     if returncode:
         raise ShellCommandException("%s: failed to `%s`" % (returncode, cmd))
开发者ID:kennethreitz-archive,项目名称:python-build,代码行数:13,代码来源:util.py


示例8: _update_config

 def _update_config(self, options, args):
     # config.cfg update
     # TODO: Automatically create for config.cfg
     download_url = PYTHONBREW_UPDATE_URL_CONFIG
     if not download_url:
         logger.error("Invalid download url in config.cfg. `%s`" % download_url)
         sys.exit(1)
     distname = Link(PYTHONBREW_UPDATE_URL_CONFIG).filename
     download_file = PATH_ETC_CONFIG
     try:
         d = Downloader()
         d.download(distname, download_url, download_file)
     except:
         logger.error("Failed to download. `%s`" % download_url)
         sys.exit(1)
     logger.log("The config.cfg has been updated.")
开发者ID:none-da,项目名称:pythonbrew,代码行数:16,代码来源:update.py


示例9: install

    def install(self):
        # cleanup
        if os.path.isdir(self.build_dir):
            shutil.rmtree(self.build_dir)

        # get content type.
        if is_file(self.download_url):
            path = fileurl_to_path(self.download_url)
            self.content_type = mimetypes.guess_type(path)[0]
        else:
            headerinfo = get_headerinfo_from_url(self.download_url)
            self.content_type = headerinfo["content-type"]
        if is_html(self.content_type):
            # note: maybe got 404 or 503 http status code.
            logger.error("Invalid content-type: `%s`" % self.content_type)
            return

        if os.path.isdir(self.install_dir):
            logger.info("You are already installed `%s`" % self.pkg.name)
            return

        self.download_and_extract()
        logger.info(
            "\nThis could take a while. You can run the following command on another shell to track the status:"
        )
        logger.info("  tail -f %s\n" % self.logfile)
        self.patch()
        logger.info("Installing %s into %s" % (self.pkg.name, self.install_dir))
        try:
            self.configure()
            self.make()
            self.make_install()
        except:
            rm_r(self.install_dir)
            logger.error("Failed to install %s. See %s to see why." % (self.pkg.name, self.logfile))
            logger.log("  pythonbrew install --force %s" % self.pkg.version)
            sys.exit(1)
        self.symlink()
        self.install_setuptools()
        logger.info(
            "\nInstalled %(pkgname)s successfully. Run the following command to switch to %(pkgname)s."
            % {"pkgname": self.pkg.name}
        )
        logger.info("  pythonbrew switch %s" % self.pkg.alias)
开发者ID:steakknife,项目名称:pythonbrew,代码行数:44,代码来源:pythoninstaller.py


示例10: call

    def call(self, cmd):
        if is_str(cmd):
            cmd = shlex.split(cmd)
        if self._debug:
            logger.log(cmd)

        fp = (self._log and open(self._log, "a")) or None
        p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, cwd=self._cwd)
        while p.returncode is None:
            while bltin_any(select.select([p.stdout], [], [])):
                line = to_str(p.stdout.readline())
                if not line:
                    break
                if self._verbose:
                    logger.log(line.strip())
                if fp:
                    fp.write(line)
                    fp.flush()
            p.poll()
        if fp:
            fp.close()
        return p.returncode
开发者ID:kennethreitz-archive,项目名称:python-build,代码行数:22,代码来源:util.py


示例11: installed

 def installed(self, options, args):
     logger.log("# pythonbrew pythons")
     cur = get_using_python_pkgname()
     for d in sorted(os.listdir(PATH_PYTHONS)):
         if cur and cur == d:
             logger.log('  %s (*)' % d)
         else:
             logger.log('  %s' % d)
开发者ID:Ank1tAggarwal,项目名称:pythonbrew,代码行数:8,代码来源:list.py


示例12: run_command_list

 def run_command_list(self, options, args):
     if options.all:
         for pkgname in get_installed_pythons_pkgname():
             workon_home = os.path.join(PATH_VENVS, pkgname)
             logger.log("# virtualenv for %(pkgname)s (found in %(workon_home)s)" % {'pkgname': pkgname, 'workon_home': workon_home})
             if os.path.isdir(workon_home):
                 for d in sorted(os.listdir(workon_home)):
                     if os.path.isdir(os.path.join(workon_home, d)):
                         logger.log(d)
     else:
         logger.log("# virtualenv for %(pkgname)s (found in %(workon_home)s)" % {'pkgname': self._pkgname, 'workon_home': self._workon_home})
         if os.path.isdir(self._workon_home):
             for d in sorted(os.listdir(self._workon_home)):
                 if os.path.isdir(os.path.join(self._workon_home, d)):
                     logger.log(d)
开发者ID:ampledata,项目名称:pythonbrew,代码行数:15,代码来源:venv.py


示例13: run_command

 def run_command(self, options, args):
     if args:
         command = args[0]
         if command not in command_dict:
             parser.error("Unknown command: `%s`" % command)
             return
         command = command_dict[command]
         command.parser.print_help()
         return
     parser.print_help()
     logger.log("\nCommands available:")
     commands = [command_dict[key] for key in sorted(command_dict.keys())]
     for command in commands:
         logger.log("  %s: %s" % (command.name, command.summary))
     logger.log("\nFurther Instructions:")
     logger.log("  https://github.com/utahta/pythonbrew")
开发者ID:Ank1tAggarwal,项目名称:pythonbrew,代码行数:16,代码来源:help.py


示例14: run_command

    def run_command(self, options, args):
        if args:
            bin_ = args[0]
        else:
            bin_ = 'python'

        # target python interpreter
        if options.python:
            pkgname = Package(options.python).name
            if not is_installed(pkgname):
                logger.error('%s is not installed.' % pkgname)
                sys.exit(1)
        else:
            pkgname = get_using_python_pkgname()

        if not pkgname:
            logger.error("Unknown python version: ( 'pythonbrew locate -p VERSION' )")
            sys.exit(1)

        if options.venv:
            venv_pkgdir = os.path.join(PATH_VENVS, pkgname)
            venv_dir = os.path.join(venv_pkgdir, options.venv)
            if not os.path.isdir(venv_dir):
                logger.error("`%s` environment was not found in %s." % (options.venv, venv_pkgdir))
                sys.exit(1)

            bindir = os.path.join(venv_dir, 'bin')
        else:
            bindir = os.path.join(PATH_PYTHONS, pkgname, 'bin')

        if not os.path.isdir(bindir):
            logger.error("`%s` is not installed." % pkgname)
            sys.exit(1)

        path = os.path.join(bindir, bin_)
        logger.log(path)
开发者ID:LTD-Beget,项目名称:pythonbrew,代码行数:36,代码来源:locate.py


示例15: available_install

 def available_install(self, options, args):
     logger.log('# Pythons')
     if args:
         pkg = Package(args[0])
         _re = re.compile(r"%s" % pkg.name)
         pkgs = []
         for pkgname in self._get_packages_name(options):
             if _re.match(pkgname):
                 pkgs.append(pkgname)
         if pkgs:
             for pkgname in pkgs:
                 logger.log("%s" % pkgname)
         else:
             logger.error("`%s` was not found." % pkg.name)
     else:
         for pkgname in self._get_packages_name(options):
             logger.log("%s" % pkgname)
开发者ID:Ank1tAggarwal,项目名称:pythonbrew,代码行数:17,代码来源:list.py


示例16: run_command

 def run_command(self, options, args):
     logger.log(VERSION)
开发者ID:Ank1tAggarwal,项目名称:pythonbrew,代码行数:2,代码来源:version.py


示例17: __init__

 def __init__(self):
     returncode = subprocess.call("command -v curl > /dev/null", shell=True)
     if returncode:
         logger.log("pythonbrew required curl. curl was not found in your path.")
         sys.exit(1)
开发者ID:Annia,项目名称:pythonbrew,代码行数:5,代码来源:curl.py


示例18: run_command_list

 def run_command_list(self, options, args):
     if options.python:
         pkgname = Package(options.python).name
         workon_home = os.path.join(PATH_VENVS, pkgname)
         if pkgname == self._pkgname:
             logger.log("%s (*)" % pkgname)
         else:
             logger.log("%s" % pkgname)
         if os.path.isdir(workon_home):
             for d in sorted(os.listdir(workon_home)):
                 if os.path.isdir(os.path.join(workon_home, d)):
                     logger.log("  %s" % d)
     else:
         for pkgname in get_installed_pythons_pkgname():
             workon_home = os.path.join(PATH_VENVS, pkgname)
             if os.path.isdir(workon_home):
                 dirs = os.listdir(workon_home)
                 if len(dirs) > 0:
                     if pkgname == self._pkgname:
                         logger.log("%s (*)" % pkgname)
                     else:
                         logger.log("%s" % pkgname)
                     for d in sorted(dirs):
                         if os.path.isdir(os.path.join(workon_home, d)):
                             logger.log("  %s" % d)
开发者ID:Annia,项目名称:pythonbrew,代码行数:25,代码来源:venv.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python util.Subprocess类代码示例发布时间:2022-05-27
下一篇:
Python logger.info函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap