Skip to content

Commit

Permalink
update const naming
Browse files Browse the repository at this point in the history
  • Loading branch information
wbrowne committed Aug 15, 2024
1 parent ca80c3e commit 5af317a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions backend/log/context_grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
)

const (
loggerParamsCtxMetadataKey = "loggerParamsCtxMetadata"
logParamSeparator = ":"
logParamsCtxMetadataKey = "loggerParamsCtxMetadata"
logParamSeparator = ":"
)

// WithContextualAttributesForOutgoingContext will append the given key/value log parameters to the outgoing context.
Expand All @@ -22,15 +22,15 @@ func WithContextualAttributesForOutgoingContext(ctx context.Context, logParams [
for i := 0; i < len(logParams); i += 2 {
k := logParams[i].(string)
v := logParams[i+1].(string)
ctx = metadata.AppendToOutgoingContext(ctx, loggerParamsCtxMetadataKey, fmt.Sprintf("%s%s%s", k, logParamSeparator, v))
ctx = metadata.AppendToOutgoingContext(ctx, logParamsCtxMetadataKey, fmt.Sprintf("%s%s%s", k, logParamSeparator, v))
}

return ctx
}

// ContextualAttributesFromIncomingContext returns the contextual key/value log parameters from the given incoming context.
func ContextualAttributesFromIncomingContext(ctx context.Context) []any {
logParams := metadata.ValueFromIncomingContext(ctx, loggerParamsCtxMetadataKey)
logParams := metadata.ValueFromIncomingContext(ctx, logParamsCtxMetadataKey)
if len(logParams) == 0 {
return nil
}
Expand Down

0 comments on commit 5af317a

Please sign in to comment.