Include information from LogEvent.error in log output if present - #245
Include information from LogEvent.error in log output if present#245samuelmurray wants to merge 3 commits into
Conversation
| public init( | ||
| level: Logger.Level, | ||
| message: Logger.Message, | ||
| error: (any Error)?, |
There was a problem hiding this comment.
I'm assuming breaking changes are ok, since it's a beta release?
|
I didn't spend too much time thinking of a good output format for the error, so I'm happy to adjust if you have any suggestions. One alternative is to simply treat it as metadata, and use some sensible keys, eg. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #245 +/- ##
==========================================
+ Coverage 71.86% 72.18% +0.31%
==========================================
Files 29 29
Lines 878 888 +10
==========================================
+ Hits 631 641 +10
Misses 247 247
🚀 New features to boost your workflow:
|
fpseverino
left a comment
There was a problem hiding this comment.
LGTM, the placement of the ErrorFragment is correct IMO, I'm not too sure about the output format, but we can change that later without breaking API
Namespace error to test suite
0xTim
left a comment
There was a problem hiding this comment.
Error output should definitely go in metadata. Only static strings should be added to the actual message as those are what are queried so need to be the same
In
swift-log, a user can attach an error object to a log entry, which is passed as-is to theLogHandlerfor it to serialise.ConsoleLogger, and the default fragment, is updated to use this property, serialising it as[ Fully.Qualified.Type: string representation ].Example:
Fixes #239