本文整理汇总了Python中util.Log.info方法的典型用法代码示例。如果您正苦于以下问题:Python Log.info方法的具体用法?Python Log.info怎么用?Python Log.info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类util.Log
的用法示例。
在下文中一共展示了Log.info方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: icon_crop
# 需要导入模块: from util import Log [as 别名]
# 或者: from util.Log import info [as 别名]
def icon_crop(user_id, icon_path, coords):
response = {}
if not os.path.exists(icon_path):
response["status"] = False
response["message"] = "Not Found: %s" % icon_path
return response
image_path, ext = os.path.splitext(icon_path)
store_dir = _get_image_dir(ICON_PATH)
thumb_name = "u%s%s%s" % (user_id, str(int(time.time())), ext)
thumb_path = os.path.join(store_dir, thumb_name)
middle_name = "u%s%sb%s" % (user_id, str(int(time.time())), ext)
middle_path = os.path.join(store_dir, middle_name)
img = Image.open(icon_path)
left, top, width, height = tuple([int(i) for i in coords.split("|")])
box = (left, top, left+width, top+height)
img_thumb = img.crop(box)
big_size = (ICON_BIG_WIDTH, ICON_BIG_WIDTH)
img_thumb = img_thumb.resize(big_size, Image.ANTIALIAS)
img_thumb.save(middle_path, quality=150)
thumb_size = (ICON_WIDTH, ICON_WIDTH)
img_thumb = img_thumb.resize(thumb_size, Image.ANTIALIAS)
img_thumb.save(thumb_path, quality=150)
try:
os.remove(icon_path)
except Exception, ex:
Log.info(ex)
示例2: _merge
# 需要导入模块: from util import Log [as 别名]
# 或者: from util.Log import info [as 别名]
def _merge(self, opponent):
from util.build_component import merge_components
import os
import tarfile
Log.info('About to merge components.')
merged_file = ""
with tarfile.open(self._component_file, 'r:gz') as one:
with tarfile.open(opponent._component_file, 'r:gz') as two:
merged_file = merge_components(one, two)
os.remove(opponent._component_file)
os.rename(merged_file, opponent._component_file)
raise MergedWarning('Merged components')
示例3: _update
# 需要导入模块: from util import Log [as 别名]
# 或者: from util.Log import info [as 别名]
def _update(self, opponent):
while True:
override = self._input('Shall I override the component %s? (y/N)' %
self.c_id)
override = override.strip().lower()
if override[0] == 'n':
Log.info('break!')
return
elif override[0] == 'y' or override[0] == 'j':
Log.info('overriding.')
self.c_pk = opponent.c_pk
self.save()
return
示例4: add
# 需要导入模块: from util import Log [as 别名]
# 或者: from util.Log import info [as 别名]
def add(cls, component):
""" A given package will be added to the local database.
A package has to be in the ctlweb-format which can be found in our
docmuentation.
returns newly created object
"""
from os import path
Log.debug("add(package): adding package to local database")
# Create Database entry
data = Component._unpack(component)
comp = cls.create(data)
comp._component_file = component
try:
comp.save()
except NoSuchTable:
comp.create_table().save()
except ValueError as e:
Log.critical('%s' % e.args[0])
return
except MergedWarning as e:
Log.info('Merged components')
return comp
# Copy package to store
comp._component_file = None # reset the component to default.
try:
comp_log = ComponentLog.get_exactly(comp['c_exe_hash'])
comp_log.remove()
except (InstanceNotFoundError, NoSuchTable):
pass
import shutil
try:
target_name = comp._component_file
shutil.copy(component, target_name)
except IOError:
Log.critical("Unable to save component to Manifest store in %s"
% store)
exit(1)
return comp
示例5: log
# 需要导入模块: from util import Log [as 别名]
# 或者: from util.Log import info [as 别名]
def log():
from util import Log
Log.info("Hello from test.py")