wechat-go icon indicating copy to clipboard operation
wechat-go copied to clipboard

Debug level

Open suntong opened this issue 7 years ago • 4 comments

Please add a "Debug level" control to wechat-go so as to control the level of logging to console, as the following is too much, if we want to keep the session going on for hours and even days:

2017/12/20 19:39:38 [I] webpush.web.wechat.com 0 2
2017/12/20 19:40:05 [I] webpush.web.wechat.com 0 0
2017/12/20 19:40:07 [I] webpush.web.wechat.com 0 2
2017/12/20 19:40:34 [I] webpush.web.wechat.com 0 0
2017/12/20 19:41:00 [I] webpush.web.wechat.com 0 0
2017/12/20 19:41:26 [I] webpush.web.wechat.com 0 0
2017/12/20 19:41:50 [I] webpush.web.wechat.com 0 2
2017/12/20 19:41:51 [W] no handlers for key [47]
2017/12/20 19:42:17 [I] webpush.web.wechat.com 0 0
2017/12/20 19:42:43 [I] webpush.web.wechat.com 0 0
2017/12/20 19:43:10 [I] webpush.web.wechat.com 0 0
2017/12/20 19:43:36 [I] webpush.web.wechat.com 0 0
2017/12/20 19:44:02 [I] webpush.web.wechat.com 0 0
2017/12/20 19:44:28 [I] webpush.web.wechat.com 0 0
2017/12/20 19:44:29 [I] webpush.web.wechat.com 0 2
2017/12/20 19:44:56 [I] webpush.web.wechat.com 0 0
2017/12/20 19:45:08 [I] webpush.web.wechat.com 0 2
2017/12/20 19:45:35 [I] webpush.web.wechat.com 0 0
2017/12/20 19:46:01 [I] webpush.web.wechat.com 0 0
2017/12/20 19:46:28 [I] webpush.web.wechat.com 0 0
2017/12/20 19:46:54 [I] webpush.web.wechat.com 0 0
2017/12/20 19:47:20 [I] webpush.web.wechat.com 0 0
2017/12/20 19:47:46 [I] webpush.web.wechat.com 0 0
2017/12/20 19:48:12 [I] webpush.web.wechat.com 0 0
2017/12/20 19:48:38 [I] webpush.web.wechat.com 0 0
2017/12/20 19:49:04 [I] webpush.web.wechat.com 0 0
2017/12/20 19:49:31 [I] webpush.web.wechat.com 0 0
2017/12/20 19:49:57 [I] webpush.web.wechat.com 0 0
2017/12/20 19:50:23 [I] webpush.web.wechat.com 0 0
2017/12/20 19:50:49 [I] webpush.web.wechat.com 0 0
2017/12/20 19:51:15 [I] webpush.web.wechat.com 0 0
2017/12/20 19:51:22 [I] webpush.web.wechat.com 0 2
2017/12/20 19:51:49 [I] webpush.web.wechat.com 0 0
2017/12/20 19:52:15 [I] webpush.web.wechat.com 0 0
2017/12/20 19:52:41 [I] webpush.web.wechat.com 0 0
2017/12/20 19:53:07 [I] webpush.web.wechat.com 0 0
2017/12/20 19:53:33 [I] webpush.web.wechat.com 0 0
2017/12/20 19:53:59 [I] webpush.web.wechat.com 0 0
2017/12/20 19:54:22 [I] webpush.web.wechat.com 0 2
2017/12/20 19:54:50 [I] webpush.web.wechat.com 0 0
2017/12/20 19:55:16 [I] webpush.web.wechat.com 0 0
2017/12/20 19:55:42 [I] webpush.web.wechat.com 0 0
2017/12/20 19:56:08 [I] webpush.web.wechat.com 0 0
2017/12/20 19:56:34 [I] webpush.web.wechat.com 0 0
2017/12/20 19:57:00 [I] webpush.web.wechat.com 0 0
2017/12/20 19:57:01 [I] webpush.web.wechat.com 0 2
2017/12/20 19:57:02 [W] no handlers for key [43]
2017/12/20 19:57:28 [I] webpush.web.wechat.com 0 0
2017/12/20 19:57:54 [I] webpush.web.wechat.com 0 0
2017/12/20 19:58:04 [I] webpush.web.wechat.com 0 2
2017/12/20 19:58:31 [I] webpush.web.wechat.com 0 0
2017/12/20 19:58:57 [I] webpush.web.wechat.com 0 0
2017/12/20 19:59:09 [I] webpush.web.wechat.com 0 2
2017/12/20 19:59:36 [I] webpush.web.wechat.com 0 0
2017/12/20 20:00:02 [I] webpush.web.wechat.com 0 0
2017/12/20 20:00:28 [I] webpush.web.wechat.com 0 0
2017/12/20 20:00:54 [I] webpush.web.wechat.com 0 0
2017/12/20 20:01:09 [I] webpush.web.wechat.com 0 2
2017/12/20 20:01:31 [I] webpush.web.wechat.com 0 2
2017/12/20 20:01:58 [I] webpush.web.wechat.com 0 0
2017/12/20 20:02:10 [I] webpush.web.wechat.com 0 2
2017/12/20 20:02:11 [W] no handlers for key [47]
2017/12/20 20:02:38 [I] webpush.web.wechat.com 0 0
2017/12/20 20:03:04 [I] webpush.web.wechat.com 0 0
2017/12/20 20:03:30 [I] webpush.web.wechat.com 0 0
2017/12/20 20:03:56 [I] webpush.web.wechat.com 0 0
2017/12/20 20:04:00 [I] webpush.web.wechat.com 0 2
2017/12/20 20:04:27 [I] webpush.web.wechat.com 0 0
2017/12/20 20:04:53 [I] webpush.web.wechat.com 0 0
2017/12/20 20:05:19 [I] webpush.web.wechat.com 0 0
2017/12/20 20:05:37 [I] webpush.web.wechat.com 0 2
2017/12/20 20:06:05 [I] webpush.web.wechat.com 0 0
2017/12/20 20:06:31 [I] webpush.web.wechat.com 0 0
2017/12/20 20:06:57 [I] webpush.web.wechat.com 0 0
2017/12/20 20:07:23 [I] webpush.web.wechat.com 0 0
2017/12/20 20:07:49 [I] webpush.web.wechat.com 0 0
2017/12/20 20:08:14 [I] webpush.web.wechat.com 0 0
2017/12/20 20:08:40 [I] webpush.web.wechat.com 0 0
2017/12/20 20:09:07 [I] webpush.web.wechat.com 0 0
2017/12/20 20:09:32 [I] webpush.web.wechat.com 0 0
2017/12/20 20:09:51 [I] webpush.web.wechat.com 0 2
2017/12/20 20:10:18 [I] webpush.web.wechat.com 0 0
2017/12/20 20:10:44 [I] webpush.web.wechat.com 0 0
2017/12/20 20:11:10 [I] webpush.web.wechat.com 0 0
2017/12/20 20:11:40 [I] webpush.web.wechat.com 0 0

we can finalize the details later...

suntong avatar Dec 21 '17 13:12 suntong

If you are not familiar with the wechat working mechanism as i was, it's helpful to print it out to see what's going on.

songtianyi avatar Dec 23 '17 07:12 songtianyi

Agree, but please also consider for those who are not familiar with the wechat working mechanism, the above logging don't make any sense to them. I.e., even I see webpush.web.wechat.com 0 0, I have no idea what it is trying to tell me...

suntong avatar Dec 23 '17 17:12 suntong

Got it, i will write the demo code for debug level control.

songtianyi avatar Dec 25 '17 01:12 songtianyi

Thanks @songtianyi,

What I had in mind was at least the following levels:

  • Quite (1). Log bare minimum info, only things the end user absolutely need to know.
  • Brief (2). Log only info that response to the user requests.
  • Debug (3+). Include internal Debug info. The higher the debug level is, the more info it will be.

suntong avatar Dec 25 '17 02:12 suntong