airflow-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Phillips <aphill...@qrmedia.com>
Subject Re: String formatting
Date Mon, 17 Oct 2016 14:20:43 GMT
> Perhaps I stand corrected! -- though I don't see where it actually says
> this approach is preferred. In any case, the Python 3 docs explicitly 
> state
> that the behavior is only maintained for backwards compatibility:
> https://docs.python.org/3/howto/logging.html#logging-variable-data

Ah, interesting! From [1], it appears that it's now possible to change 
the placeholder syntax so that the messages look somewhat more "modern". 
As far as I can tell, variable components of the log messages are still 
intended to be passed as arguments, though?

So with the style change, the log message could look like this:

logging.info("A message with a param: {}", param)

Regards

ap

[1] 
https://docs.python.org/3/howto/logging-cookbook.html#formatting-styles

Mime
View raw message