Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f3dd99d

Browse files
committedJul 3, 2024··
config: Implement stdoutlog exporter
1 parent 9ad9ebb commit f3dd99d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
 

‎config/log.go

+11
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"time"
1212

1313
"go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp"
14+
"go.opentelemetry.io/otel/exporters/stdout/stdoutlog"
1415
"go.opentelemetry.io/otel/log"
1516
"go.opentelemetry.io/otel/log/noop"
1617
sdklog "go.opentelemetry.io/otel/sdk/log"
@@ -64,6 +65,16 @@ func logProcessor(ctx context.Context, processor LogRecordProcessor) (sdklog.Pro
6465
}
6566

6667
func logExporter(ctx context.Context, exporter LogRecordExporter) (sdklog.Exporter, error) {
68+
if exporter.Console != nil && exporter.OTLP != nil {
69+
return nil, errors.New("must not specify multiple exporters")
70+
}
71+
72+
if exporter.Console != nil {
73+
return stdoutlog.New(
74+
stdoutlog.WithPrettyPrint(),
75+
)
76+
}
77+
6778
if exporter.OTLP != nil {
6879
switch exporter.OTLP.Protocol {
6980
case protocolProtobufHTTP:

0 commit comments

Comments
 (0)
Please sign in to comment.