-
Notifications
You must be signed in to change notification settings - Fork 725
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pass log kwargs to custom sink #2
Comments
Reading a bit more it looks like you can use |
Hey, thanks for your interest and suggestion! So, you are looking for a behavior similar to the one of the I thought about it, unfortunately I do not think it's possible. I agree that
|
I didn't know structlog existed. Neat. I guess- yes. I don't see why it matters if the data is used by |
@volfco I am closing this issue as I can't find a solution that would fit in the api as I would like. I prefer to avoid special cases and I try to stay close to the "one way of do it" principle. Structured logging in Loguru is performed using A basic example: logger.start(sys.stderr, format="[{time}][{level}] {message} | {extra}")
app, version = "MyApp", "0.2.3"
ip, port = "192.168.0.10", 22
logger.info("Starting '{}' (v{})", app, version)
logger.bind(ip=ip, port=port).info("Sending a request") For advanced structured logging, Loguru can't beat |
Well, I'm sorry it took a year and a half, but... This feature is finally available. 🙂 The |
🥳 |
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.
I would expect that
{"hello": "world"}
to be somewhere in the payload passed to the custom sinkThe text was updated successfully, but these errors were encountered: