-
Notifications
You must be signed in to change notification settings - Fork 756
Closed
Labels
featureRequest for adding a new featureRequest for adding a new feature
Description
Loguru supports string formatting, but it seems that these kwargs are dropped if there is nothing to format in the string. I would think these would be passed to the custom sink, but it does not seem like this is the case.
See the below example.
>>> from loguru import logger
>>>
>>> def callback(payload):
... print(payload)
...
>>> logger.start(callback, serialize=True)
>>> logger.info("testing", hello="world")
2018-12-08 15:56:07.675 | INFO | __main__:<module>:1 - yoo
{"text": "2018-12-08 15:56:07.675 | INFO | __main__:<module>:1 - testing\n", "record": {"elapsed": {"repr": "0:01:35.065585", "seconds": 95.065585}, "exception": null, "extra": {}, "file": {"name": "<stdin>", "path": "<stdin>"}, "function": "<module>", "level": {"icon": "\u2139\ufe0f", "name": "INFO", "no": 20}, "line": 1, "message": "testing", "module": "<stdin>", "name": "__main__", "process": {"id": 22013, "name": "MainProcess"}, "thread": {"id": 140289032955392, "name": "MainThread"}, "time": {"repr": "2018-12-08 15:56:07.675593-06:00", "timestamp": 1544306167.675593}}}
>>> logger.info("testing {hello}", hello="world")
2018-12-08 15:58:37.702 | INFO | __main__:<module>:1 - testing world
{"text": "2018-12-08 15:58:37.702 | INFO | __main__:<module>:1 - testing world\n", "record": {"elapsed": {"repr": "0:04:05.092374", "seconds": 245.092374}, "exception": null, "extra": {}, "file": {"name": "<stdin>", "path": "<stdin>"}, "function": "<module>", "level": {"icon": "\u2139\ufe0f", "name": "INFO", "no": 20}, "line": 1, "message": "testing world", "module": "<stdin>", "name": "__main__", "process": {"id": 22013, "name": "MainProcess"}, "thread": {"id": 140289032955392, "name": "MainThread"}, "time": {"repr": "2018-12-08 15:58:37.702382-06:00", "timestamp": 1544306317.702382}}}
I would expect that {"hello": "world"} to be somewhere in the payload passed to the custom sink
Metadata
Metadata
Assignees
Labels
featureRequest for adding a new featureRequest for adding a new feature