opentelemetry-go-contrib icon indicating copy to clipboard operation
opentelemetry-go-contrib copied to clipboard

config: add stdout exporter for log signal

Open codeboten opened this issue 9 months ago • 1 comments

Problem Statement

As it was done for metric and tracing, the logging signal should support configuring a console exporter via config.

Proposed Solution

Add the following code and add unit tests as well.

	if exporter.Console != nil && exporter.OTLP != nil {
	 	return nil, errors.New("must not specify multiple exporters")
	 }

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

Additional Context

This was not possible because of a change needed in the configuration schema (https://github.com/open-telemetry/opentelemetry-configuration/commit/834ae3c589341da26b39c8dc142e55a5b50eaed0) which has been merged, but updating the configuration package depends on https://github.com/open-telemetry/opentelemetry-go-contrib/pull/4832 to support another change in the configuration schema.

codeboten avatar Apr 26 '24 15:04 codeboten