You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How can I configure this library to use new-style {} for formatting?
I note the code appears to have style arguments in appropriate places, e.g. here - but I cannot actually get this working.
Some things I tried:
importlogger_ttlogger_tt.setup_logging(full_context=1)
logger_tt.logger.critical("hello {}", "world")
# TypeError: not all arguments converted during string formatting
It should have also passed in the style param when calling super.
But this fix is just applied for the format of the formatters as the Python doc says so.
eg. this line: format: "[{asctime}] [{name}:{lineno} {levelname}] {message}"
Secondly, since your target is to be able to use the bracket in the individual log message,
like logger_tt.logger.critical("hello {}", "world"),
this needs more work as it is not supported by the standard logging module.
Thirdly, please note that since logger-tt uses QueueHandler and SocketHandler behind the scene, these handlers will merge the message string and arguments before putting the log record into the queue or sending it. This is just to ensure the log record is pickleable. This behavior will also defeat the purpose of not evaluating the message string if the log record is filtered and only if you have that intention in mind. Anyway, since logger-tt does the logging in a different thread or process, the performance impact is neglectable.
So if you want to use the bracket format in the individual log message, please wait a little more until this function is implemented.
How can I configure this library to use new-style
{}
for formatting?I note the code appears to have
style
arguments in appropriate places, e.g. here - but I cannot actually get this working.Some things I tried:
The following are all using this python and different
cfg.yaml
s:Default file, verbatim:
Sure, this makes sense. So let's mark the formatters as
style: {
:(
[...]
in the above is unchanged from the first example)It's complaining that the formatter has no fields. Sure, it probably needs the format changed too to newstyle. Let's try that:
...wait, what? But it just complained a moment ago that
%
-style formatting didn't work!The text was updated successfully, but these errors were encountered: