是否可以将日志从内置logging
模块重定向到Slack通道,而不是stdout或文件。
我当时想使用Slack API client可能有某种方法:
import logging
from slackclient import SlackClient
slack_token = 'MY-TOKEN-HERE'
sc = SlackClient(slack_token)
logging.basicConfig(...) # Some slack magic???
logging.debug('This message should go to a slack channel')
logging.info('So should this')
logging.warning('And this, too')