Skip to content

Add attributes to logs #7303

Answered by Flooze-IT
Flooze-IT asked this question in Q&A
Nov 24, 2022 · 3 comments · 1 reply
Discussion options

You must be logged in to vote

I found the solution, i need to use the LogRecordBuilder :

logger
            .eventBuilder(reason)
            .setBody("Error in function: "+functionName+" with this reason: "+reason)
            .setSeverity(Severity.ERROR)
            .setAttribute(AttributeKey.stringKey("requestId"),requestId)

and then emit it

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@Flooze-IT
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by trask
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants