diff --git a/internal/log/log.go b/internal/log/log.go index 7aa9f1e..b70ff22 100644 --- a/internal/log/log.go +++ b/internal/log/log.go @@ -3,16 +3,22 @@ package log import ( "context" "fmt" + "github.com/google/uuid" "github.com/loveuer/nf" ulog "github.com/loveuer/nf/nft/log" ) func _mix(ctx context.Context, msg string) string { if ctx == nil { - return msg + return fmt.Sprintf("%s | %s", uuid.Must(uuid.NewV7()).String(), msg) } - return fmt.Sprintf("%v | %s", ctx.Value(nf.TraceKey), msg) + traceId := ctx.Value(nf.TraceKey) + if traceId == nil { + return fmt.Sprintf("%s | %s", uuid.Must(uuid.NewV7()).String(), msg) + } + + return fmt.Sprintf("%s | %s", traceId, msg) } func Debug(ctx context.Context, msg string, data ...any) {