Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go/logging: libp2p log adapter #4547

Merged
merged 1 commit into from
Mar 8, 2022
Merged

go/logging: libp2p log adapter #4547

merged 1 commit into from
Mar 8, 2022

Conversation

ptrus
Copy link
Member

@ptrus ptrus commented Mar 7, 2022

Fixes: #4531

libp2p logs are now emitted through oasis-node logging system.

Example logs:

{"caller":"id.go:453","level":"debug","module":"libp2p:net/identify","msg":"/ipfs/id/1.0.0 received message from 12D3KooWCUm3BxCXj5UTfkhbRnxb7hicz3tTTZbphbKhGSz3vTdb /ip4/192.168.88.233/tcp/20020","ts":"2022-03-08T08:47:57.699910867Z"}
{"caller":"obsaddr.go:397","level":"debug","module":"libp2p:net/identify","msg":"added own observed listen addr","observed":"/ip4/192.168.88.233/tcp/20012","ts":"2022-03-08T08:47:57.700039654Z"}
{"caller":"id.go:649","level":"debug","module":"libp2p:net/identify","msg":"12D3KooWBPiJ4rzKgz4NRka2zRAMF5JDYXNf6r5xDMxuusWNZYaw received listen addrs for 12D3KooWCUm3BxCXj5UTfkhbRnxb7hicz3tTTZbphbKhGSz3vTdb: [/ip4/192.168.88.233/tcp/20020]","ts":"2022-03-08T08:47:57.700066819Z"}
{"caller":"gossipsub.go:511","level":"debug","module":"libp2p:pubsub","msg":"PEERUP: Add new peer 12D3KooWCUm3BxCXj5UTfkhbRnxb7hicz3tTTZbphbKhGSz3vTdb using /meshsub/1.1.0","ts":"2022-03-08T08:47:57.700137429Z"}
{"caller":"basic_host.go:414","level":"debug","module":"libp2p:basichost","msg":"protocol negotiation took 770.404µs","ts":"2022-03-08T08:47:57.700386848Z"}
{"caller":"gossipsub.go:807","level":"debug","module":"libp2p:pubsub","msg":"GRAFT: add mesh link from 12D3KooWCUm3BxCXj5UTfkhbRnxb7hicz3tTTZbphbKhGSz3vTdb in 1de8816252b0093d3ad4b113923e44178f7ef43e09946bd2b4a49326cecc3573/4/8000000000000000000000000000000000000000000000000000000000000000/tx","ts":"2022-03-08T08:47:58.05448337Z"}
{"caller":"basic_host.go:414","level":"debug","module":"libp2p:basichost","msg":"protocol negotiation took 56.272µs","ts":"2022-03-08T08:48:01.703049297Z"}
{"caller":"validation.go:457","level":"debug","module":"libp2p:pubsub","msg":"validation done; took 92.596µs","ts":"2022-03-08T08:48:01.705158878Z"}
{"caller":"validation.go:457","level":"debug","module":"libp2p:pubsub","msg":"validation done; took 69.458µs","ts":"2022-03-08T08:48:01.716050092Z"}
{"caller":"basic_host.go:414","level":"debug","module":"libp2p:basichost","msg":"protocol negotiation took 46.358µs","ts":"2022-03-08T08:48:05.594683073Z"}
{"caller":"basic_host.go:414","level":"debug","module":"libp2p:basichost","msg":"protocol negotiation took 48.098µs","ts":"2022-03-08T08:48:05.594955572Z"}
{"caller":"pubsub.go:626","level":"info","module":"libp2p:pubsub","msg":"pubsub processloop shutting down","ts":"2022-03-08T08:48:10.61096531Z"}

Wrapping zap into go-git is not as performant as using zap directly, but the consistency is worth it i think. If we're concerend with logging performance we could look into using something like zap or zerolog as the base of common/logger.

@kostko
Copy link
Member

kostko commented Mar 7, 2022

Could we prefix modules with libp2p: similar to what we do for tendermint?

@ptrus
Copy link
Member Author

ptrus commented Mar 8, 2022

Could we prefix modules with libp2p: similar to what we do for tendermint?

Yeah, just thinking if the prefix should be ipfs:? Since technically this sets the ipfs logger, which could be used by other libs as well (but most likely libp2p is the only dependency that uses it)

@kostko
Copy link
Member

kostko commented Mar 8, 2022

Yeah I would set it to libp2p as ipfs would make it seem we are using ipfs and this would be confusing :-)

@ptrus ptrus force-pushed the ptrus/feature/ipfs-logging branch from ee87f98 to 8dea1a1 Compare March 8, 2022 08:35
@ptrus ptrus added the s:ready-ci Status: ready for CI label Mar 8, 2022
@ptrus ptrus force-pushed the ptrus/feature/ipfs-logging branch 3 times, most recently from 9fcdaf6 to 848f84d Compare March 8, 2022 09:18
@ptrus ptrus marked this pull request as ready for review March 8, 2022 09:34
@ptrus
Copy link
Member Author

ptrus commented Mar 8, 2022

Yeah I would set it to libp2p as ipfs would make it seem we are using ipfs and this would be confusing :-)

Done, see updated example in the PR description

@ptrus ptrus force-pushed the ptrus/feature/ipfs-logging branch from 848f84d to 94f0f39 Compare March 8, 2022 09:41
@ptrus ptrus force-pushed the ptrus/feature/ipfs-logging branch from 94f0f39 to c48a04c Compare March 8, 2022 09:43
@ptrus ptrus enabled auto-merge March 8, 2022 09:45
@ptrus ptrus merged commit af089cd into master Mar 8, 2022
@ptrus ptrus deleted the ptrus/feature/ipfs-logging branch March 8, 2022 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s:ready-ci Status: ready for CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adapt libp2p logger to our logging system
3 participants