From aee2908ed16ca899e08a31db7822886461cc1aaa Mon Sep 17 00:00:00 2001 From: Evstigneev Denis Date: Fri, 6 Dec 2024 00:29:35 +0300 Subject: [PATCH] removed add loggerContextAttr --- .gitignore | 12 ++++++++++++ requestid.go | 15 +-------------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index 66fd13c..2fd3987 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,9 @@ +# Develop tools +/.vscode/ +/.idea/ +.idea +.vscode + # Binaries for programs and plugins *.exe *.exe~ @@ -5,6 +11,12 @@ *.so *.dylib +# Folders +_obj +_test +_build +.DS_Store + # Test binary, built with `go test -c` *.test diff --git a/requestid.go b/requestid.go index 68ed8f7..4227c2c 100644 --- a/requestid.go +++ b/requestid.go @@ -2,26 +2,13 @@ package requestid // import "go.unistack.org/micro-wrapper-requestid/v3" import ( "context" - "net/textproto" - "strings" - "go.unistack.org/micro/v3/client" - "go.unistack.org/micro/v3/logger" "go.unistack.org/micro/v3/metadata" "go.unistack.org/micro/v3/server" "go.unistack.org/micro/v3/util/id" + "net/textproto" ) -func init() { - requestIDLog := strings.ToLower(DefaultMetadataKey) - logger.DefaultContextAttrFuncs = append(logger.DefaultContextAttrFuncs, func(ctx context.Context) []interface{} { - if v, ok := ctx.Value(XRequestIDKey{}).(string); ok { - return []interface{}{requestIDLog, v} - } - return nil - }) -} - type XRequestIDKey struct{} // DefaultMetadataKey contains metadata key