我的Python脚本使用写入日志文件
log.startLogging(sys.stdout)
和log.startLogging(DailyLogFile.fromFullPath('sms.log'))
。它做得很好。
但它有点笨重而且无聊。所以我不想用特定标签将其解析为XML而没有不必要的信息,所以它对人眼来说更美观。
已发送的内容和向谁发送信息:电话号码(29999999),文本(text1),用户ID(666)和事件ID(1):
2018-04-26 11:42:25+0300 [-] ('29999999', 'text1', '666', '1')
2018-04-26 11:42:25+0300 [SMSManagementProtocol,client] TX WAMP: [7,"psevent:send_sms",{"sms_txt":"text1","id_nr":"666","key":"1","phone_nr":"29999999"},null]
2018-04-26 11:42:25+0300 [-] ('29999999', 'text2', '666', '2')
2018-04-26 11:42:25+0300 [SMSManagementProtocol,client] TX WAMP: [7,"psevent:send_sms",{"sms_txt":"text2","id_nr":"666","key":"2","phone_nr":"29999999"},null]
2018-04-26 11:42:25+0300 [-] ('29999999', 'text3', '666', '3')
2018-04-26 11:42:25+0300 [SMSManagementProtocol,client] TX WAMP: [7,"psevent:send_sms",{"sms_txt":"text3","id_nr":"666","key":"3","phone_nr":"29999999"},null]
EVENT(如果已发送或发生错误,则显示状态响应):
2018-04-26 11:43:23+0300 [-] EVENT: http://test.com/publicsubscribeon_sms_delivered_OK KEY: 1
2018-04-26 11:43:23+0300 [SMSManagementProtocol,client] RX WAMP: [8, "http://test.com/publicsubscribeon_sms_delivered_OK", "3"]
2018-04-26 11:43:23+0300 [-] EVENT: http://test.com/publicsubscribeon_sms_delivered_OK KEY: 3
2018-04-26 11:43:23+0300 [SMSManagementProtocol,client] RX WAMP: [8, "http://test.com/publicsubscribeon_sms_delivered_OK", "2"]
2018-04-26 11:43:23+0300 [-] EVENT: http://test.com/publicsubscribeon_sms_delivered_OK KEY: 2
有没有办法删除不必要的日志信息?我只需要数据。
有什么建议吗?