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

[Feature Request] Can debug print output to a configured logger? #122

Open
zhuoqun-chen opened this issue Mar 15, 2023 · 3 comments
Open

Comments

@zhuoqun-chen
Copy link

debug is a wonderful tool and saved me a lot of time for debugging. And In my projects, I used to configure my owner logger for recording some running information. And now I use both debug() and logger.debug().

However, when they are used together, the terminal looks like this:

image

But another tool I'm using called Hydra can also format some information into its configured logger, and the result looks like this:
image

So I assume if debug can offer similar option, it will be amazing.

Can your team kindly consider to support this feature?

Appreciated your maintenance. Thanks!

@alexmojaki
Copy link
Contributor

What about debug.format?

@zhuoqun-chen
Copy link
Author

zhuoqun-chen commented Aug 19, 2023

What about debug.format?

Hi alexmojaki,

Thanks for the advice! But currently I'm not sure how to use debug.format function to do this because the integration with a custom logger is not listed in the documentation of devtools.

Or are you suggesting something like:

a = torch.tensor([1, 2, 3])
logger.debug(debug.format(a))

Could you please give me more explanations or examples? Thx again.

@samuelcolvin
Copy link
Owner

debug.format() takes the same arguments debug() but returns the formatted string instead of printing it.

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

No branches or pull requests

3 participants