本文整理汇总了Python中pythonz.log.logger.log函数的典型用法代码示例。如果您正苦于以下问题:Python log函数的具体用法?Python log怎么用?Python log使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了log函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: read
def read(cls, url):
try:
r = urllib.urlopen(url)
except IOError:
logger.log(traceback.format_exc())
raise DownloadError('Failed to fetch.')
return r.read()
开发者ID:tanaka-takayoshi,项目名称:pythonz,代码行数:7,代码来源:downloader.py
示例2: install_pythonz
def install_pythonz():
PythonzInstaller.install(INSTALLER_ROOT)
# for bash
shrc = yourshrc = "bashrc"
logger.log("""
Well-done! Congratulations!
The pythonz 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:
pythonz install 2.7.2
pythonz install 3.2
For further instructions, run:
pythonz help
The default help messages will popup and tell you what to do!
Enjoy pythonz at %(ROOT)s!!
""" % {'ROOT': ROOT, 'yourshrc': yourshrc, 'shrc': shrc, 'PATH_ETC': PATH_ETC.replace(os.getenv('HOME'), '$HOME')})
开发者ID:EvertonSilva,项目名称:pythonz,代码行数:29,代码来源:__init__.py
示例3: read
def read(self, url):
try:
r = urllib.urlopen(url)
except IOError:
logger.log(traceback.format_exc())
raise CurlFetchException('Failed to fetch.')
return r.read()
开发者ID:yamaneko1212,项目名称:pythonz,代码行数:7,代码来源:genericdownloader.py
示例4: fetch
def fetch(cls, url, filename):
b = ProgressBar()
try:
urllib.urlretrieve(url, filename, b.reporthook)
sys.stdout.write('\n')
except IOError:
sys.stdout.write('\n')
logger.log(traceback.format_exc())
raise DownloadError('Failed to fetch.')
开发者ID:tanaka-takayoshi,项目名称:pythonz,代码行数:9,代码来源:downloader.py
示例5: readheader
def readheader(self, url):
try:
req = HEADRequest(url)
res = urllib2.urlopen(req)
except IOError:
logger.log(traceback.format_exc())
raise CurlFetchException('Failed to fetch.')
if res.code != 200:
raise CurlFetchException('Failed to fetch.')
return res.info()
开发者ID:yamaneko1212,项目名称:pythonz,代码行数:10,代码来源:genericdownloader.py
示例6: 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:rayleyva,项目名称:pythonz,代码行数:10,代码来源:pythoninstaller.py
示例7: read_head_info
def read_head_info(cls, url):
try:
req = HEADRequest(url)
res = urllib2.urlopen(req)
except IOError:
logger.log(traceback.format_exc())
raise DownloadError('Failed to fetch.')
if res.code != 200:
raise DownloadError('Failed to fetch.')
return res.info()
开发者ID:tanaka-takayoshi,项目名称:pythonz,代码行数:10,代码来源:downloader.py
示例8: run_command
def run_command(self, options, args):
if not args or len(args) > 1:
self.parser.print_help()
return
pkg = Package(args[0], options.type)
pkgname = pkg.name
if not is_installed(pkg):
logger.error("`%s` is not installed." % pkgname)
return
logger.log(os.path.join(PATH_PYTHONS, pkgname, 'bin', 'python'))
开发者ID:Eyepea,项目名称:pythonz,代码行数:11,代码来源:locate.py
示例9: 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:msabramo,项目名称:pythonz,代码行数:13,代码来源:util.py
示例10: _update_config
def _update_config(self, options, args):
# config.cfg update
# TODO: Automatically create for config.cfg
download_url = PYTHONZ_UPDATE_URL_CONFIG
if not download_url:
logger.error("Invalid download url in config.cfg. `%s`" % download_url)
sys.exit(1)
distname = Link(PYTHONZ_UPDATE_URL_CONFIG).filename
download_file = PATH_ETC_CONFIG
logger.info("Downloading %s as %s" % (distname, download_file))
try:
Downloader.fetch(download_url, download_file)
except DownloadError:
logger.error("Failed to download. `%s`" % download_url)
sys.exit(1)
logger.log("The config.cfg has been updated.")
开发者ID:msabramo,项目名称:pythonz,代码行数:16,代码来源:update.py
示例11: run_command
def run_command(self, options, args):
if not args or len(args) > 1:
self.parser.print_help()
sys.exit(1)
pkg = Package(args[0], options.type)
pkgname = pkg.name
if not is_installed(pkg):
logger.error("`%s` is not installed." % pkgname)
sys.exit(1)
for bin in ('python3', 'python', 'pypy3', 'pypy'):
path = os.path.join(PATH_PYTHONS, pkgname, 'bin', bin)
if os.path.exists(path):
break
else:
# fallback
path = os.path.join(PATH_PYTHONS, pkgname, 'bin', 'python')
logger.log(path)
开发者ID:Kaemka,项目名称:pythonz,代码行数:18,代码来源:locate.py
示例12: installed
def installed(self, path):
logger.log("# Installed Python versions")
for d in sorted(os.listdir(PATH_PYTHONS)):
if path:
logger.log(' %-16s %s/%s' % (d, PATH_PYTHONS, d))
else:
logger.log(' %s' % d)
开发者ID:Kaemka,项目名称:pythonz,代码行数:7,代码来源:list.py
示例13: all
def all(self):
logger.log('# Available Python versions')
for type, versions in PYTHON_VERSIONS_URLS.iteritems():
if versions:
logger.log(' # %s:' % type)
for version in (version for version in sorted(versions.keys())):
logger.log(' %s' % version)
开发者ID:msabramo,项目名称:pythonz,代码行数:7,代码来源:list.py
示例14: 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 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:msabramo,项目名称:pythonz,代码行数:22,代码来源:util.py
示例15: installed
def installed(self):
logger.log("# Installed Python versions")
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:Epictetus,项目名称:pythonz,代码行数:8,代码来源:list.py
示例16: all
def all(self, py_type):
logger.log('# Available Python versions')
py_types = [py_type] if py_type else PY_TYPES
for type_ in py_types:
logger.log(' # %s:' % type_)
for version in sorted(PY_INSTALLERS[type_].supported_versions):
logger.log(' %s' % version)
开发者ID:Kaemka,项目名称:pythonz,代码行数:8,代码来源:list.py
示例17: run_command
def run_command(self, options, args):
if args:
command = args[0]
if command not in command_map:
self.parser.error("Unknown command: `%s`" % command)
return
command = command_map[command]
command.parser.print_help()
return
self.parser.print_help()
logger.log("\nCommands available:")
commands = [command_map[key] for key in sorted(command_map.keys())]
for command in commands:
logger.log(" %s: %s" % (command.name, command.summary))
logger.log("\nFurther Instructions:")
logger.log(" https://github.com/saghul/pythonz")
开发者ID:EvertonSilva,项目名称:pythonz,代码行数:16,代码来源:help.py
示例18: systemwide_pythonz
def systemwide_pythonz():
PythonzInstaller.install(INSTALLER_ROOT)
PythonzInstaller.systemwide_install()
logger.log("""
Well-done! Congratulations!
The pythonz is installed as:
%(ROOT)s
After that, exit this shell, start a new one, and install some fresh
pythons:
pythonz install 2.7.2
pythonz install 3.2
For further instructions, run:
pythonz help
The default help messages will popup and tell you what to do!
Enjoy pythonz at %(ROOT)s!!
""" % {'ROOT':ROOT})
开发者ID:EvertonSilva,项目名称:pythonz,代码行数:24,代码来源:__init__.py
示例19: all
def all(self, py_type):
logger.log('# Available Python versions')
groups = zip(PY_TYPES,
[CPythonInstaller, StacklessInstaller, PyPyInstaller,
PyPy3Installer, JythonInstaller])
if py_type:
groups = filter(lambda (impl, _): impl in py_type, groups)
for type_, installer in groups:
logger.log(' # %s:' % type_)
for version in sorted(installer.supported_versions):
logger.log(' %s' % version)
开发者ID:inirudebwoy,项目名称:pythonz,代码行数:13,代码来源:list.py
示例20: installed
def installed(self):
logger.log("# Installed Python versions")
for d in sorted(os.listdir(PATH_PYTHONS)):
logger.log(' %s' % d)
开发者ID:msabramo,项目名称:pythonz,代码行数:4,代码来源:list.py
注:本文中的pythonz.log.logger.log函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论