-
Notifications
You must be signed in to change notification settings - Fork 704
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
logging full warning message #30
Comments
Hey @KarinaMarks, glad you like Loguru. 👍 Thanks for the explanations and the detailed examples, it helps a lot to understand the problem! So, as you noticed, About the actual formatting of these exceptions. As you understood, this is partly related to The second thing is that the exceptions are displayed entirely. The place where the error was caught is marked with a small I guess the best solution is to make If you have other questions or need some clarifications, don't hesitate. 😉 |
@Delgan |
@blueyed I definitely could add some documentation about this, thanks for the idea! The |
Just a note from a lurker. The particular %-formatting that Useful to know for a potential EDIT: I was incorrect to say that the arguments are not evaluated. What is true is that string interpolation does not take place in |
@randallpittman Thanks for your remark! But I'm not sure to understand. What do you mean by "the arguments are not evaluated"? One thing for sure is that the formatting is not processed if the log level is not high enough. In such case, The |
@Delgan Hmm, I think I was half wrong. I was thinking the arguments didn't get computed if you used the |
@randallpittman Yes, I guess this particularly saves time for objects with non-trivial |
Ok, this is fixed in the Setting I will write the "logging --> loguru guide" and ping you once it's done. 👍 |
@blueyed @randallpittman Just to let you know, I added a small guide about migrating from I will probably add more snippets in the future. |
Not sure if we can use f-strings:
|
@chrisgeru What do you mean by a formatting function being safe or not? |
Hi @Delgan ,
Thanks for the great package! I'm swapping from the core logging package to loguru in a python package I am developing. In general the swap has been really easy - but I'm having a problem with warnings/error messages.
I have made a minimal example of the conversion I am trying to make and the log outputs. From the logging package:
Which returns the following log:
Converting this into loguru the warning traceback doesn't seem to work:
I get the output:
See how I'm missing the traceback here?
I have a similar issue with errors, but they're giving too much information back in loguru - I think this is to do with better_exceptions, can this be turned off?
To make the above code work for errors I have just changed:
UserWarning("I'm warning you!")
toAssertionError("You're not assertive!")
logger.warning("Warning encountered in function: ", exc_info=True)
tologger.exception("Error encountered in function: ")
I get the following logs for both packages:
From logging
From loguru
I see information on using the
backtrace=True/False
argument, but that still gives much more information on the error than I am looking for. I am guessing the error problem is to do with better_exceptions? I'm not sure about the warning one. I would really appreciate some help with this.Thanks!
The text was updated successfully, but these errors were encountered: