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

fix: IPFS_LOG_LEVEL is actually deprecated, help text updated #10694

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

SgtPooki
Copy link
Member

@SgtPooki SgtPooki commented Feb 4, 2025

The ipfs log --help text is updated to recommend the correct environment variable, and the debug logging check is more robust when checking if debug logging should be enabled.

When running ipfs log --help I noticed two environment variables I was unfamiliar with. This PR updates every place where IPFS_LOG_LEVEL was used, to GOLOG_LOG_LEVEL, and IPFS_LOG_FMT to GOLOG_LOG_FMT, but does not completely "sunset" the deprecated environment variables.

The IPFS_LOG_LEVEL environment variable was still in use in the code, so I think fully removing it at this point would be premature, let me know if you think otherwise.

NOTE: these env vars were documented as deprecated in #8833

Copy link
Member Author

@SgtPooki SgtPooki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self review

Comment on lines +229 to +232
ipfsLogLevel, _ := logging.LevelFromString(os.Getenv("IPFS_LOGGING")) // IPFS_LOGGING is deprecated
goLogLevel, _ := logging.LevelFromString(os.Getenv("GOLOG_LOG_LEVEL"))

if debug || goLogLevel == logging.LevelDebug || ipfsLogLevel == logging.LevelDebug {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

based on the documentation at https://github.com/ipfs/go-log#usage I think this should do what we want (support non-deprecated env var, still allow old one..)

This change also corrects functionality to where export GOLOG_LOG_LEVEL="debug,subsystem=info" will actually enable debug logging, instead of potentially not.

AFAIK, "debug,system=info" == "debug" would have previously returned false. Idk if that was intended or not.

@SgtPooki SgtPooki marked this pull request as ready for review February 4, 2025 15:02
@SgtPooki SgtPooki requested a review from a team as a code owner February 4, 2025 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants