Skip to content

Commit

Permalink
config: Implement stdoutlog exporter
Browse files Browse the repository at this point in the history
  • Loading branch information
robinknaapen committed Jul 3, 2024
1 parent af75717 commit 66c5762
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions config/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"time"

"go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp"
"go.opentelemetry.io/otel/exporters/stdout/stdoutlog"
"go.opentelemetry.io/otel/log"
"go.opentelemetry.io/otel/log/noop"
sdklog "go.opentelemetry.io/otel/sdk/log"
Expand Down Expand Up @@ -64,6 +65,16 @@ func logProcessor(ctx context.Context, processor LogRecordProcessor) (sdklog.Pro
}

func logExporter(ctx context.Context, exporter LogRecordExporter) (sdklog.Exporter, error) {
if exporter.Console != nil && exporter.OTLP != nil {
return nil, errors.New("must not specify multiple exporters")
}

if exporter.Console != nil {
return stdoutlog.New(
stdoutlog.WithPrettyPrint(),
)
}

if exporter.OTLP != nil {
switch exporter.OTLP.Protocol {
case protocolProtobufHTTP:
Expand Down

0 comments on commit 66c5762

Please sign in to comment.