def console_write(self, color, message):
""" Writes message to console.
:param color: the colorama color representation.
:param message: str the message to write.
"""
msg_encoded = message.encode('ascii', 'ignore')
if config.USE_24HOUR:
ts = time.strftime('%H:%M:%S')
else:
ts = time.strftime('%I:%M:%S:%p')
if config.CONSOLE_COLORS:
msg = COLOR['white'] + '[' + ts + '] ' + Style.RESET_ALL + color + msg_encoded
else:
msg = '[' + ts + '] ' + msg_encoded
try:
print(msg)
except UnicodeEncodeError as ue:
log.error(ue, exc_info=True)
if config.DEBUG_MODE:
traceback.print_exc()
if config.CHAT_LOGGING:
write_to_log('[' + ts + '] ' + message, self.roomname)
pinylib.py 文件源码
python
阅读 19
收藏 0
点赞 0
评论 0
评论列表
文章目录