本文整理汇总了Python中logs.Logs类的典型用法代码示例。如果您正苦于以下问题:Python Logs类的具体用法?Python Logs怎么用?Python Logs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Logs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_not_recommended_count_by_shop
def get_not_recommended_count_by_shop(shop):
try:
return UserShopRelationMethods.get_by_shop(shop).filter(
is_recommended=UserShopRelationMethods.NOT_RECOMMENDED).count()
except Exception as ex:
Logs.print_current_function_name_and_line_number(ex)
return 0
示例2: get_user_extension
def get_user_extension(username):
try:
u = UserExtension.objects.get(user__username=username)
return u
except Exception as ex:
Logs.print_current_function_name_and_line_number(ex)
return Users.get_none()
示例3: get_attribute_by_user_and_publish
def get_attribute_by_user_and_publish(user_id, publish_id):
try:
upr = UserPublishRelations.objects.get(user_id=user_id, publish_id=publish_id)
return upr.attribute
except Exception as ex:
Logs.print_current_function_name_and_line_number(ex)
return -1
示例4: get_memory_file
def get_memory_file(url):
try:
# Logs.print_log("get memory file url", url)
return cStringIO.StringIO(urllib2.urlopen(url, data=None, timeout=10).read())
except Exception as ex:
Logs.print_current_function_name_and_line_number(ex)
return None
示例5: get_user_by_id
def get_user_by_id(user_id):
try:
u = User.objects.get(id=user_id)
return u
except Exception as ex:
Logs.print_current_function_name_and_line_number(ex)
return Users.get_none()
示例6: get_publishes_by_device
def get_publishes_by_device(device_id):
try:
publishes = Publish.objects.filter(device_id=device_id)
return publishes
except Exception as ex:
Logs.print_current_function_name_and_line_number(ex)
return None
示例7: get_info
def get_info(red_envelope):
try:
result = Objects.get_object_info(red_envelope)
return result
except Exception as ex:
Logs.print_current_function_name_and_line_number(ex)
return dict()
示例8: get
def get(name):
try:
# Logs.print_log("name", name)
return Company.objects.get(name=name)
except Exception as ex:
Logs.print_current_function_name_and_line_number(ex)
return None
示例9: get_user_image
def get_user_image(user):
result = dict()
if user:
if user.userextension.big_image:
user_image = files.BASE_URL_4_IMAGE + user.userextension.big_image.name
# Logs.print_log("user_image", user_image)
else:
if user.userextension.gender == "M":
user_image = USER_DEFAULT_MALE_ICON
else:
user_image = USER_DEFAULT_FEMALE_ICON
else:
user_image = USER_DEFAULT_ICON
memory_file = files.Files.get_memory_file(user_image)
user_image_path = "/".join(user_image.split("/")[:-1])
user_image_name = user_image.split("/")[-1]
big_user_image_name = ".".join(user_image_name.split(".")[:-1]) + "_big." + user_image_name.split(".")[-1]
small_user_image_name = ".".join(user_image_name.split(".")[:-1]) + "_small." + user_image_name.split(".")[-1]
big_user_image = user_image_path + "/" + big_user_image_name
small_user_image = user_image_path + "/" + small_user_image_name
try:
Images.resize_image(memory_file, big_user_image, 240)
Images.resize_image(memory_file, small_user_image, 96)
result["big_user_image"] = big_user_image
result["small_user_image"] = small_user_image
except Exception as ex:
Logs.print_current_function_name_and_line_number(ex)
if user.userextension.gender == "M":
result["big_user_image"] = USER_DEFAULT_MALE_ICON
result["small_user_image"] = USER_DEFAULT_MALE_ICON
else:
result["big_user_image"] = USER_DEFAULT_FEMALE_ICON
result["small_user_image"] = USER_DEFAULT_FEMALE_ICON
return result
示例10: set_node_text
def set_node_text(node, text):
try:
node.text = text
return node
except Exception as ex:
Logs.print_current_function_name_and_line_number(ex)
return None
示例11: set_node_attribute
def set_node_attribute(node, attribute_key, attribute_value):
try:
node.set(attribute_key, attribute_value)
return node
except Exception as ex:
Logs.print_current_function_name_and_line_number(ex)
return None
示例12: get_file_name
def get_file_name(url):
try:
names = url.split("/")
return names[-1]
except Exception as ex:
Logs.print_current_function_name_and_line_number(ex)
return None
示例13: to_utc
def to_utc(dt):
try:
dt = Datetimes.transfer_datetime(dt, is_utc=False)
return dt.replace(tzinfo=utc)
except Exception as ex:
Logs.print_current_function_name_and_line_number(ex)
return None
示例14: Sql
class Sql(object):
__instance__ = None
def __new__(cls):
if cls.__instance__ is None:
cls.__instance__ = object.__new__(cls)
cls.__construct__(cls.__instance__)
return cls.__instance__
def __construct__(self):
object.__init__(self)
self.__config = Config()
self.__logs = Logs()
# init connection param
self._config_load()
# connect
try:
self.__logs.debug('Try to connect to Mysql')
self._connect = MySQLdb.connect(host=self.__host,
user=self.__user,
passwd=self.__pass,
port=self.__port,
db=self.__db)
except Exception, e:
self.__logs.fatal('Mysql connection failure: %s' % (e))
self.__logs.debug('Connection okay.')
示例15: get_articles
def get_articles(user_id, status):
try:
ufs = UserForumArticle.objects.filter(user_id=user_id, status=status, count__gt=0)
return ufs
except Exception as ex:
Logs.print_current_function_name_and_line_number(ex)
return UserForumArticleMethod.get_none()