本文整理汇总了Python中utils.logger.Logger.log方法的典型用法代码示例。如果您正苦于以下问题:Python Logger.log方法的具体用法?Python Logger.log怎么用?Python Logger.log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utils.logger.Logger
的用法示例。
在下文中一共展示了Logger.log方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: find_matches
# 需要导入模块: from utils.logger import Logger [as 别名]
# 或者: from utils.logger.Logger import log [as 别名]
def find_matches(subscriptions, reddit, database):
Logger.log('Finding Matches...', Color.GREEN)
subreddits = {}
matches = []
for subscription in subscriptions:
subreds = subscription.data[Subscription.SUBREDDITS]
for subreddit in subreds:
if subreddit.lower() not in [k.lower() for k in subreddits.keys()]:
Logger.log(subreddit.lower(), Color.CYAN)
submissions = reddit.get_submissions(subreddit.lower())
temp = []
for sub in submissions:
temp.append(sub)
subreddits[subreddit.lower()] = temp
submissions = subreddits[subreddit.lower()]
# submissions = reddit.get_submissions(subreddit)
num = 0
for submission in submissions:
num += 1
is_match, mismatched_keys = MatchFinder.is_match(subscription, submission)
if is_match:
already_exists = database.check_if_match_exists(subscription.username,
subscription.to_string(),
submission.permalink)
if not already_exists:
matches.append((subscription, submission))
return matches
示例2: __init__
# 需要导入模块: from utils.logger import Logger [as 别名]
# 或者: from utils.logger.Logger import log [as 别名]
def __init__(self, quiet_start=0, quiet_end=0):
if quiet_end < quiet_start:
Logger.log('Invalid Quiet Hours.', Color.RED)
exit()
self.quiet_start = quiet_start
self.quiet_stop = quiet_end
self.is_quiet = False
示例3: information_exception
# 需要导入模块: from utils.logger import Logger [as 别名]
# 或者: from utils.logger.Logger import log [as 别名]
def information_exception(username):
Logger.log(
'information exception caught\n' +
'username: ' + username + '\n' +
'stacktrace: ' + '\n' +
traceback.format_exc() + '\n\n',
Color.RED)
示例4: subscriptions_exception
# 需要导入模块: from utils.logger import Logger [as 别名]
# 或者: from utils.logger.Logger import log [as 别名]
def subscriptions_exception(username):
Logger.log(
'subscriptions exception caught\n' +
'username: ' + username + '\n' +
'stacktrace: ' + '\n' +
traceback.format_exc() + '\n\n',
Color.RED)
示例5: subscriptions
# 需要导入模块: from utils.logger import Logger [as 别名]
# 或者: from utils.logger.Logger import log [as 别名]
def subscriptions(username):
Logger.log(
'-------------------------------\n' +
' SUBSCRIPTIONS\n' +
'username: ' + username + '\n' +
'-------------------------------\n\n',
Color.GREEN)
示例6: information
# 需要导入模块: from utils.logger import Logger [as 别名]
# 或者: from utils.logger.Logger import log [as 别名]
def information(username):
Logger.log(
'-------------------------------\n' +
' INFORMATION\n' +
'username: ' + username + '\n' +
'-------------------------------\n\n',
Color.GREEN)
示例7: unsubscribe_all
# 需要导入模块: from utils.logger import Logger [as 别名]
# 或者: from utils.logger.Logger import log [as 别名]
def unsubscribe_all(username):
Logger.log(
'-------------------------------\n' +
' UNSUBSCRIBE ALL\n' +
'username: ' + username + '\n' +
'-------------------------------\n\n',
Color.RED)
示例8: unsubscribe_all_exception
# 需要导入模块: from utils.logger import Logger [as 别名]
# 或者: from utils.logger.Logger import log [as 别名]
def unsubscribe_all_exception(username):
Logger.log(
'unsubscribe all exception caught\n' +
'username: ' + username + '\n' +
'stacktrace: ' + '\n' +
traceback.format_exc() + '\n\n',
Color.RED)
示例9: username_mention
# 需要导入模块: from utils.logger import Logger [as 别名]
# 或者: from utils.logger.Logger import log [as 别名]
def username_mention(username, body):
Logger.log(
'-------------------------------\n' +
' USERNAME MENTION\n' +
'username: ' + username + '\n' +
'body: ' + body + '\n' +
'-------------------------------\n\n',
Color.GREEN)
示例10: feedback
# 需要导入模块: from utils.logger import Logger [as 别名]
# 或者: from utils.logger.Logger import log [as 别名]
def feedback(username, user_feedback):
Logger.log(
'-------------------------------\n' +
' FEEDBACK\n' +
'username: ' + username + '\n' +
'feedback: ' + user_feedback + '\n' +
'-------------------------------\n\n',
Color.GREEN)
示例11: unsubscribe
# 需要导入模块: from utils.logger import Logger [as 别名]
# 或者: from utils.logger.Logger import log [as 别名]
def unsubscribe(username, item):
Logger.log(
'-------------------------------\n' +
' UNSUBSCRIBE\n' +
'username: ' + username + '\n' +
'item: ' + item + '\n' +
'-------------------------------\n\n',
Color.RED)
示例12: subscribe
# 需要导入模块: from utils.logger import Logger [as 别名]
# 或者: from utils.logger.Logger import log [as 别名]
def subscribe(username, item):
Logger.log(
'-------------------------------\n' +
' SUBSCRIBE\n' +
'username: ' + username + '\n' +
'item: ' + item + '\n' +
'-------------------------------\n\n',
Color.GREEN)
示例13: post_reply
# 需要导入模块: from utils.logger import Logger [as 别名]
# 或者: from utils.logger.Logger import log [as 别名]
def post_reply(username, body):
Logger.log(
'-------------------------------\n' +
' POST REPLY\n' +
'username: ' + username + '\n' +
'body: ' + body + '\n' +
'-------------------------------\n\n',
Color.GREEN)
示例14: check_for_commands
# 需要导入模块: from utils.logger import Logger [as 别名]
# 或者: from utils.logger.Logger import log [as 别名]
def check_for_commands(self):
Logger.log('Checking for commands')
commands = CommandHandler.get_commands(self.reddit)
if CommandHandler.PAUSE in commands:
self.run = False
if CommandHandler.RUN in commands:
self.run = True
if CommandHandler.KILL in commands:
exit()
示例15: unsubscribe_exception
# 需要导入模块: from utils.logger import Logger [as 别名]
# 或者: from utils.logger.Logger import log [as 别名]
def unsubscribe_exception(username, item):
Logger.log(
'unsubscribe exception caught\n' +
'username: ' + username + '\n' +
'item: ' + item + '\n' +
'stacktrace: ' + '\n' +
traceback.format_exc() + '\n\n',
Color.RED)