You've already forked golang-saas-starter-kit
mirror of
https://github.com/raseels-repos/golang-saas-starter-kit.git
synced 2025-12-24 00:01:31 +02:00
completed schema migration
This commit is contained in:
19
example-project/internal/platform/logger/log.go
Normal file
19
example-project/internal/platform/logger/log.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package logger
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"geeks-accelerator/oss/saas-starter-kit/example-project/internal/platform/web"
|
||||
)
|
||||
|
||||
// WithContext manual injects context values to log message including Trace ID
|
||||
func WithContext(ctx context.Context, msg string) string {
|
||||
v, ok := ctx.Value(web.KeyValues).(*web.Values)
|
||||
if !ok {
|
||||
return msg
|
||||
}
|
||||
|
||||
cm := fmt.Sprintf("dd.trace_id=%d dd.span_id=%d", v.TraceID, v.SpanID)
|
||||
|
||||
return cm + ": " + msg
|
||||
}
|
||||
Reference in New Issue
Block a user