You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to encode the caller information (file, line & function) so it matches the requirements for GCP LogEntry's LogEntrySourceLocation field. This is important so the caller information can be automatically extracted by GCP's LogAgent.
A result should look something like the following:
Setting the callerKey to the value required by LogEntry was not a Problem, neither was gathering the required information (file, line& function). Unfortunately I could not figure out a way to implement a custom CallerEncoder to match the required format with a nested object.
// An excerpt from zapcore/encoder.go:264// A CallerEncoder serializes an EntryCaller to a primitive type.typeCallerEncoderfunc(EntryCaller, PrimitiveArrayEncoder)
I am wondering whether it is possible to achieve this with the given PrimitiveArrayEncoder. I saw functions like AppendObject(), but these were only accessible from an ArrayEncoder.
I hope I was able to explain the problem in an understandable way.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hey there! 🙂
I am trying to encode the caller information (file, line & function) so it matches the requirements for GCP LogEntry's LogEntrySourceLocation field. This is important so the caller information can be automatically extracted by GCP's LogAgent.
A result should look something like the following:
Setting the callerKey to the value required by LogEntry was not a Problem, neither was gathering the required information (file, line& function). Unfortunately I could not figure out a way to implement a custom CallerEncoder to match the required format with a nested object.
I am wondering whether it is possible to achieve this with the given PrimitiveArrayEncoder. I saw functions like AppendObject(), but these were only accessible from an ArrayEncoder.
I hope I was able to explain the problem in an understandable way.
Great regards,
Dario
Beta Was this translation helpful? Give feedback.
All reactions