-
Notifications
You must be signed in to change notification settings - Fork 16
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
Add a way to log errors within the function #143
Comments
What's the benefit of a dedicated log.Info("Something went wrong", "error", err) |
i) Better and clearer syntax when logging an error. As an example: Assuming xrMetadata is keys and values holding xr metadata information,
where xrMetadata needs to now include ["error", error] vs with Error:
where xrMetadata can simply be xr metadata. ii) Error spits out stacktrace by default without any other changes to the way logger is setup:
iii) Also, seeing that, per function development convention, functions will never return an error, ( It is workable with Info(), but think it would be cleaner with a dedicated Error method on the Logger interface. |
Emitting logs using |
What problem are you facing?
Logger for functions defined here is setup to proxy logger defined in crossplane-runtime here, which only allows logging
Info
andDebug
level logs as function logs. AsRunFunction
is only expected to append errors asResults
toRunFunctionResponse
and that it never returns an error even when we add a fatal result to theRunFunctionResponse
,outside of looking at XRs status we don't have a means to log those errors on the function.
How could Crossplane help solve your problem?
The solution suggested would involve setting up a
FnLogger
interface withError()
added and an implementation to invoke logger's Error() method to log errors.Please find the proposed changes here.
The text was updated successfully, but these errors were encountered: