def logger(command):
"""
Add a logger to the decorated command.
"""
@wraps(command)
# pylint: disable=bad-whitespace
# pylint: disable=unused-argument
def wrapper(bot, update, **kwargs):
command( update, **kwargs)
if command.__name__ == 'unknown':
command.__name__ = _get_command_name(update.message.text)
message = LOG_TEMPLATE.format(user=update.user.first_name,
command=command.__name__)
logging.info(message)
return wrapper
评论列表
文章目录