42wim / matterircd

Connect to your mattermost or slack using your IRC-client of choice.
MIT License
294 stars 60 forks source link

Logging with timestamp #364

Closed hloeung closed 3 years ago

hloeung commented 3 years ago

Some lines are logged without timestamps. e.g.

INFO[2020-12-25T04:27:05Z] Running version 0.21.1-dev                    module=matterircd
INFO[2020-12-25T04:27:05Z] WARNING: THIS IS A DEVELOPMENT VERSION. Things may break.  module=matterircd
INFO[2020-12-25T04:27:05Z] Listening on 127.0.0.1:6697                   module=matterircd
INFO[2020-12-25T04:28:01Z] New connection: 127.0.0.1:52986               module=matterircd
...
loggerlevel: info
INFO[0066] login as hloeung (team: myteam) on mychat.mydomain
[0066]  INFO matterclient: Found version 5.27.0.5.27.0.3bd4fc983a4aa622183c3bd1e77029e0.true
[0070]  INFO matterclient: found 1111 users in team myteam
INFO[0072] login succeeded

This makes it so the login lines as well as matterclient also log timestamp:

loggerlevel: info
INFO[2020-12-25T04:55:03Z] login as hloeung (team: myteam) on mychat.mydomain
[2020-12-25T04:55:04Z]  INFO matterclient: Found version 5.27.0.5.27.0.3bd4fc983a4aa622183c3bd1e77029e0.true
[2020-12-25T04:55:08Z]  INFO matterclient: found 1111 users in team myteam
INFO[2020-12-25T04:55:10Z] login succeeded

This is also useful for logging matterclient INFO/ERROR lines such as:

[56747]  INFO matterclient: reconnect: login
[56757] ERROR matterclient: reconnect: login failed: ... context deadline exceeded (Client.Timeout exceeded while awaiting headers)", retrying in 10 seconds
42wim commented 3 years ago

thanks!