New filterable logging system #43

Merged
sarah merged 1 commits from dan/libricochet-go:logging into master 2018-12-03 20:19:59 +00:00
Owner

New filterable logging system. Will allow cleaner output of stable distributed runtimes, but will also allow for easier debugging, as during dev, filters and settings can be adjusted to temporarily turn on more debuging logging printing in areas.

the .Df, .If, .Dln etc was an idea from Kotlins log.D() log.I() etc, feel free to pane and say we should use .Debugf etc?

The two filtering methods allow different style of extra log inclusion beyond log level, everythingFrom allows you to pull in more details from specific packages you think might be the problem, and nothingExcept allows you to clear away excess and just focus on an area.

Added the following to echobot:

log.SetLevel(log.LevelInfo)
log.AddEverythingFromPattern("connectivity")

and got

2018/11/30 13:02:28 connectivity/torProvider.go [DBUG] dialing system tor control port
2018/11/30 13:02:28 connectivity/torProvider.go [DBUG] connected to control port
2018/11/30 13:02:28 connectivity/torProvider.go [DBUG] torversions: [0 3 5 3-alpha]
2018/11/30 13:02:28 connectivity/torProvider.go [DBUG] OK version 0.3.5.3-alpha
2018/11/30 13:02:28 echobot/main.go [INFO] echobot listening on eyulkdluec4dkuffysmpck63zmi4szi7ugy66jxzr4cri4yg7ndaatyd.onion:9878
2018/11/30 13:02:28 echobot/main.go [INFO] counting to five ...
2018/11/30 13:02:49 echobot/main.go [INFO] [alice] requesting channel...
2018/11/30 13:02:49 echobot/main.go [INFO] [alice] sending...
2018/11/30 13:02:49 echobot/main.go [INFO] [alice] sending 'be gay' to echobot
2018/11/30 13:02:49 echobot/main.go [INFO] [alice] sending...
2018/11/30 13:02:49 echobot/main.go [INFO] [alice] sending 'do crime' to echobot
2018/11/30 13:02:50 echobot/main.go [INFO] message from yx3uisnkt3uxpcs5jbryevidvyxkswajo5egq23kusbt6453yjasleid - be gay
2018/11/30 13:02:50 echobot/main.go [INFO] message from yx3uisnkt3uxpcs5jbryevidvyxkswajo5egq23kusbt6453yjasleid - do crime
2018/11/30 13:02:50 echobot/main.go [INFO] [alice] inbound connection established
2018/11/30 13:02:50 echobot/main.go [INFO] [alice] got message from echobot: yx3uisnkt3uxpcs5jbryevidvyxkswajo5egq23kusbt6453yjasleid be gay
2018/11/30 13:02:50 echobot/main.go [INFO] [alice] message "be gay" ack'd
2018/11/30 13:02:51 echobot/main.go [INFO] [alice] got message from echobot: yx3uisnkt3uxpcs5jbryevidvyxkswajo5egq23kusbt6453yjasleid do crime
2018/11/30 13:02:51 echobot/main.go [INFO] [alice] message "do crime" ack'd
New filterable logging system. Will allow cleaner output of stable distributed runtimes, but will also allow for easier debugging, as during dev, filters and settings can be adjusted to temporarily turn on more debuging logging printing in areas. the .Df, .If, .Dln etc was an idea from Kotlins log.D() log.I() etc, feel free to pane and say we should use .Debugf etc? The two filtering methods allow different style of extra log inclusion beyond log level, everythingFrom allows you to pull in more details from specific packages you think might be the problem, and nothingExcept allows you to clear away excess and just focus on an area. Added the following to echobot: ``` log.SetLevel(log.LevelInfo) log.AddEverythingFromPattern("connectivity") ``` and got ``` 2018/11/30 13:02:28 connectivity/torProvider.go [DBUG] dialing system tor control port 2018/11/30 13:02:28 connectivity/torProvider.go [DBUG] connected to control port 2018/11/30 13:02:28 connectivity/torProvider.go [DBUG] torversions: [0 3 5 3-alpha] 2018/11/30 13:02:28 connectivity/torProvider.go [DBUG] OK version 0.3.5.3-alpha 2018/11/30 13:02:28 echobot/main.go [INFO] echobot listening on eyulkdluec4dkuffysmpck63zmi4szi7ugy66jxzr4cri4yg7ndaatyd.onion:9878 2018/11/30 13:02:28 echobot/main.go [INFO] counting to five ... 2018/11/30 13:02:49 echobot/main.go [INFO] [alice] requesting channel... 2018/11/30 13:02:49 echobot/main.go [INFO] [alice] sending... 2018/11/30 13:02:49 echobot/main.go [INFO] [alice] sending 'be gay' to echobot 2018/11/30 13:02:49 echobot/main.go [INFO] [alice] sending... 2018/11/30 13:02:49 echobot/main.go [INFO] [alice] sending 'do crime' to echobot 2018/11/30 13:02:50 echobot/main.go [INFO] message from yx3uisnkt3uxpcs5jbryevidvyxkswajo5egq23kusbt6453yjasleid - be gay 2018/11/30 13:02:50 echobot/main.go [INFO] message from yx3uisnkt3uxpcs5jbryevidvyxkswajo5egq23kusbt6453yjasleid - do crime 2018/11/30 13:02:50 echobot/main.go [INFO] [alice] inbound connection established 2018/11/30 13:02:50 echobot/main.go [INFO] [alice] got message from echobot: yx3uisnkt3uxpcs5jbryevidvyxkswajo5egq23kusbt6453yjasleid be gay 2018/11/30 13:02:50 echobot/main.go [INFO] [alice] message "be gay" ack'd 2018/11/30 13:02:51 echobot/main.go [INFO] [alice] got message from echobot: yx3uisnkt3uxpcs5jbryevidvyxkswajo5egq23kusbt6453yjasleid do crime 2018/11/30 13:02:51 echobot/main.go [INFO] [alice] message "do crime" ack'd ```
First-time contributor
Drone Build Status: success https://build.openprivacy.ca/openprivacy/libricochet-go/102
Owner

Looks good. Let's switch to a more verbose API.

Looks good. Let's switch to a more verbose API.
First-time contributor
Drone Build Status: success https://build.openprivacy.ca/openprivacy/libricochet-go/103
sarah closed this pull request 2018-12-03 20:19:58 +00:00
This repo is archived. You cannot comment on pull requests.
No reviewers
No Milestone
No Assignees
3 Participants
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: openprivacy/libricochet-go#43
No description provided.