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

bug: @libp2p/logger doesn't work in service workers #2778

Closed
SgtPooki opened this issue Oct 22, 2024 · 2 comments
Closed

bug: @libp2p/logger doesn't work in service workers #2778

SgtPooki opened this issue Oct 22, 2024 · 2 comments
Labels
need/triage Needs initial labeling and prioritization

Comments

@SgtPooki
Copy link
Member

SgtPooki commented Oct 22, 2024

When attempting to use @libp2p/logger in the service-worker gateway, logs generated by the service worker were not being logged until I explicitly overrode the @libp2p/logger's forComponent and prefixLogger functions.

see ipfs/service-worker-gateway#395

Repro repo at https://github.com/SgtPooki/libp2p-logger-bug-repro

@SgtPooki SgtPooki added the need/triage Needs initial labeling and prioritization label Oct 22, 2024
@achingbrain
Copy link
Member

You need to import enable from @libp2p/logger and not debug.

Part of the point of wrapping debug with @libp2p/logger is that it allows us to swap out the underlying log implementation without having to change any calling code which is what happened in #2648 - calling through to the underlying implementation directly defeats the whole purpose.

@SgtPooki
Copy link
Member Author

using enable from @libp2p/logger works, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need/triage Needs initial labeling and prioritization
Projects
None yet
Development

No branches or pull requests

2 participants