Log messages dispatched using the swift-log backend are missing normal swift-log formatting. #1389
-
Checklist
Describe the bug Log messages dispatched using the swift-log backend are missing normal swift-log formatting. Importantly, this might be an issue with our code because we are using CocoaLumberjack in a slightly unusual fashion. Specifically, we are instantiating a local instance of And: Messages are logged to the
But the
To Reproduce
Expected behavior For logs written to the
Environment info
Additional context As mentioned, I am open to the possibility that I am just passing incorrect, or incorrect, values to the local Thanks, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
@thisisaaronland First of all a big thanks to you for a very well written issue here! Including a reproduction project and a very detailed explanation. This helps a log to understand what you're trying to do and to help you out! I've converted this to a discussion in our Q&A section, because you already (correctly) pointed out, that this might be an issue with your setup. Now to the problem at hand: You will need to do this formatting yourself using a If you want consistent formatting, I'd actually recommend not using the Small note, though: If you're using Let me know if that helped or if you have any further questions! |
Beta Was this translation helpful? Give feedback.
-
Thanks for your reply. That was exactly what I needed to make things work the way I'd like. |
Beta Was this translation helpful? Give feedback.
@thisisaaronland First of all a big thanks to you for a very well written issue here! Including a reproduction project and a very detailed explanation. This helps a log to understand what you're trying to do and to help you out!
I've converted this to a discussion in our Q&A section, because you already (correctly) pointed out, that this might be an issue with your setup.
Now to the problem at hand:
This is actually working as designed. In
swift-log
, formatting is done by the log handler. What you see when using theStreamLogHandler.standardOutput
is done here. As soon as you use a different log handler (like the one CocoaLumberjack provides), this code is no longer executed.You will nee…