Passed
Push — master ( 5fb140...f50c84 )
by Tolga
01:04 queued 13s
created

logexporters.ExporterFactory   A

Complexity

Conditions 4

Size

Total Lines 8
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 8
nop 5
dl 0
loc 8
rs 10
c 0
b 0
f 0
1
package logexporters
2
3
import (
4
	"fmt"
5
6
	"github.com/agoda-com/opentelemetry-logs-go/exporters/otlp/otlplogs"
7
)
8
9
// ExporterFactory - Create log exporter according to given params
10
func ExporterFactory(name, endpoint string, insecure bool, urlpath string, headers map[string]string) (*otlplogs.Exporter, error) {
11
	switch name {
12
	case "otlp", "otlp-http":
13
		return NewOTLP(endpoint, insecure, urlpath, headers)
14
	case "otlp-grpc":
15
		return nil, fmt.Errorf("%s log exporter is unsupported", name)
16
	default:
17
		return nil, fmt.Errorf("%s log exporter is unsupported", name)
18
	}
19
}
20