uranusjr commented on code in PR #57532:
URL: https://github.com/apache/airflow/pull/57532#discussion_r2544491547
##########
airflow-core/src/airflow/models/xcom.py:
##########
@@ -210,10 +210,11 @@ def set(
)
log.warning(
warning_message,
- "return value" if key == XCOM_RETURN_KEY else f"value {key}",
+ "return value" if key == XCOM_RETURN_KEY else "value %s",
Review Comment:
I don’t think this would work. This is the second argument and putting the
template placeholder would not work as you expect.
```pycon
>>> import logging, sys
>>> logging.basicConfig(stream=sys.stdout, level=logging.INFO)
>>> logging.getLogger('').info('foo %s', 'bar %s', 1)
--- Logging error ---
Traceback (most recent call last):
File "logging/__init__.py", line 1100, in emit
msg = self.format(record)
File "logging/__init__.py", line 943, in format
return fmt.format(record)
File "logging/__init__.py", line 678, in format
record.message = record.getMessage()
File "logging/__init__.py", line 368, in getMessage
msg = msg % self.args
TypeError: not all arguments converted during string formatting
Call stack:
File "<stdin>", line 1, in <module>
Message: 'foo %s'
Arguments: ('bar %s', 1)
```
It’s probably a good idea to switch this to use structlog instead.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]