Skip to content

How to change a struct field of a core in a multiCore logger? #1215

Answered by abhinav
cideM asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @cideM. Depending on what information you need in the middleware,
there are a couple ways to make your Sentry Core behave nicely here.

Minimal information

As a starting point: if the information you need is all present in a log
entry's metadata (the Entry), you can do this work in a Core.Check
implementation.

For background, the Core.Check method is expected to return a CheckedEntry
on which it has registered one or more other cores that are interested in
logging that entry.
There's nothing stopping the Sentry Core from putting a different instance
on the checked entry:

func (c *sentryCore) Check(ent zapcore.Entry, ce *zapcore.CheckedEntry) *zapcore.CheckedEntry {
    if ent.LoggerName 

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@cideM
Comment options

Answer selected by cideM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants