Fixed datadog logs json format issue
This commit is contained in:
parent
dae0491b61
commit
e77a66c2ac
2 changed files with 17 additions and 0 deletions
13
pkg/log/datadog.go
Normal file
13
pkg/log/datadog.go
Normal file
|
@ -0,0 +1,13 @@
|
|||
package log
|
||||
|
||||
type DatadogLogger struct {
|
||||
logger Logger
|
||||
}
|
||||
|
||||
func NewDatadogLogger(logger Logger) *DatadogLogger {
|
||||
return &DatadogLogger{logger: logger}
|
||||
}
|
||||
|
||||
func (d DatadogLogger) Log(msg string) {
|
||||
d.logger.Debug(msg)
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package datadog
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net"
|
||||
"os"
|
||||
|
@ -47,6 +48,8 @@ func (c *Config) SetDefaults() {
|
|||
|
||||
// Setup sets up the tracer.
|
||||
func (c *Config) Setup(serviceName string) (opentracing.Tracer, io.Closer, error) {
|
||||
ctx := log.With(context.Background(), log.Str(log.MetricsProviderName, "datadog"))
|
||||
|
||||
opts := []datadog.StartOption{
|
||||
datadog.WithService(serviceName),
|
||||
datadog.WithDebugMode(c.Debug),
|
||||
|
@ -56,6 +59,7 @@ func (c *Config) Setup(serviceName string) (opentracing.Tracer, io.Closer, error
|
|||
PriorityHeader: c.SamplingPriorityHeaderName,
|
||||
BaggagePrefix: c.BagagePrefixHeaderName,
|
||||
})),
|
||||
datadog.WithLogger(log.NewDatadogLogger(log.FromContext(ctx))),
|
||||
}
|
||||
|
||||
if c.LocalAgentSocket != "" {
|
||||
|
|
Loading…
Reference in a new issue