Skip to content

Commit 968ab2c

Browse files
committed
fix(logging): define constants globally
1 parent 6a23591 commit 968ab2c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

pkg/logging/logger.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ import (
1111
"go.opentelemetry.io/otel/trace"
1212
)
1313

14+
const (
15+
defaultVersion = "dev"
16+
emptyTraceID = ""
17+
)
18+
1419
// Initialize sets up global logging configuration
1520
func Initialize(service, level string) {
1621
// Configure time format
@@ -126,19 +131,14 @@ func getVersion() string {
126131
if version := os.Getenv("SERVICE_VERSION"); version != "" {
127132
return version
128133
}
129-
const (
130-
defaultVersion = "dev"
131-
emptyString = ""
132-
)
133-
134134
return defaultVersion
135135
}
136136

137137
// getTraceID extracts trace ID from context (placeholder for OpenTelemetry integration)
138138
func getTraceID(ctx context.Context) string {
139139
span := trace.SpanFromContext(ctx)
140140
if !span.SpanContext().IsValid() {
141-
return emptyString
141+
return emptyTraceID
142142
}
143143
return span.SpanContext().TraceID().String()
144144
}

0 commit comments

Comments
 (0)