Is there a way to disable message formatting ?
See original GitHub issueHi Delgan !
I was wondering if there was a way to disable the message formatting with the args/kwargs ?
from loguru import logger
kwargs = {"a": 1, "b": 2}
logger.info(f"Is this going to be alright ? {kwargs}", additional_infos=kwargs)
Traceback:
Traceback (most recent call last):
File "/tmp/test.py", line 4, in <module>
logger.info(f"Is this going to be alright ? {kwargs}", additional_infos=kwargs)
File "/Users/gjeusel/miniconda3/envs/greenpandas/lib/python3.6/site-packages/loguru/_logger.py", line 1971, in info
__self._log("INFO", None, False, __self._options, __message, args, kwargs)
File "/Users/gjeusel/miniconda3/envs/greenpandas/lib/python3.6/site-packages/loguru/_logger.py", line 1948, in _log
log_record["message"] = message.format(*args, **kwargs)
KeyError: "'a'"
Is it a feature you would be inclined in adding ?
Maybe parametrized by an environment variable or via logger.configure
?
Cordially !
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:20 (7 by maintainers)
Top Results From Across the Web
Enable or disable full rich-text formatting in a rich text box
Right-click the rich text box for which you want to enable or disable full rich-text formatting, and then click Rich Text Box Properties...
Read more >is there a way to disable formatting in the message bar? - Reddit
It's in the settings menu.
Read more >How to disable plain text mode in Gmail - cloudHQ Support
Click 'Compose' in your Gmail's left navigation bar: · Click the 'More options' (three dots) in the email composition pop-up window: · Make...
Read more >How do I turn off Slack's new format while typing?
Go to Preferences -> Advanced -> Input Options and enable Format messages with markup .
Read more >Set your message formatting preference - Slack
Under Input Options, check or uncheck the box next to Format messages with markup. Markup. Once you've set your formatting preference, you can...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I may have some ideas to allow more freedom in configuring the message formatting. I think this feature might be of interest to some people, in your case and others. But I’m not sure of anything, we’ll see. I’ll keep this issue open in the meantime. 👍
@mastern2k3 You can use f-strings as long as you do not call the logging method with formatting arguments:
I got your point, though. I plan to remove automatic formatting in favor of f-strings.