Skip to content

Conversation

thewhaleking
Copy link
Contributor

@thewhaleking thewhaleking commented Aug 14, 2025

Adds a new debug log with pertinent information.

File location settable by env var BTCLI_DEBUG_FILE (default ~/.bittensor/debug.txt)

To be paired with opentensor/async-substrate-interface#178

Each new command rewrites the debug log. Intended to be used for troubleshooting. Users can send us this information.

Use can definitely be expanded, but want to see if we get any use out of this before going down that road.

Also adds btcli --debug which will copy the file so that it is not overwritten to a user-specified place.

Sample debug export log:
debug.txt

@thewhaleking thewhaleking requested a review from a team August 14, 2025 21:46
@thewhaleking thewhaleking self-assigned this Aug 14, 2025
@thewhaleking thewhaleking added the enhancement New feature or request label Aug 14, 2025
Comment on lines +613 to +621
try:
with (
open(save_file_loc, "w+") as save_file,
open(
os.getenv("BTCLI_DEBUG_FILE")
or os.path.expanduser(defaults.config.debug_file_path),
"r",
) as current_file,
):
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we also create the location if it doesnt exist?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's the magic of open(..., "w+")

@thewhaleking thewhaleking merged commit 49b8384 into staging Sep 8, 2025
102 of 149 checks passed
@thewhaleking thewhaleking deleted the feat/thewhaleking/debug-cmd branch September 8, 2025 18:50
@thewhaleking thewhaleking mentioned this pull request Sep 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants