SLG-0003: Error parameter implementation#425
Conversation
1621efc to
4bf7b23
Compare
97bf262 to
e7fd54c
Compare
|
Seeing as the change to |
e7fd54c to
79f5bc1
Compare
kukushechkin
left a comment
There was a problem hiding this comment.
Thank you for the implementation, looks great overall! Let's iron out magic metadata entries vs explict error.
|
As for the failing CI checks:
|
Right, the |
|
Unrelated to this PR: |
Co-authored-by: Vladimir Kukushkin <kukushechkin@mac.com>
|
I've pushed an update to the benchmark thresholds, this should make it pass. |
There was a problem hiding this comment.
We should probably get rid of this TestLogger and replace it with the InMemoryLogHandler at some point in the future
Add new methods on
Loggerthat allows the caller to attachErrors to log events, which will be propagated to theLogHandleras-is.Motivation:
Error information is typically of high interest in logs and log analysis. Currently, however, there is no standardized way of attaching
Errorinformation to logs, forcing users to either append it to the log message (logger.warning("Something went wrong: \(error)")), or attach it as metadata. By providing a separate parameter for this, and passing it as-is to theLogHandler, we both provide a standard, visible way to attach it, while also letting theLogHandlerformat it as it sees fit.Closes #291
Modifications:
Loggerthat accept an (optional)Error.errorproperty is added toLogEvent, which contains theErrorfrom the newLoggermethods.LogHandlerimplementations to serialize error as metadata.Result:
Users of
Loggercan use the new methods to attachErrors to their logs, which should help unify howErrors get logged in various code bases.LogHandlerimplementations can use the newerrorproperty onLogEventand serialize it in a way that's suitable for that implementation. In general, extracting the string representation and the (qualified) type name should be a good baseline.