Add Fatalf to standard logger-ish
This commit is contained in:
		| @@ -34,3 +34,8 @@ func (l stdLoggerish) Println(msg ...interface{}) { | ||||
| func (l stdLoggerish) Printf(msg string, args ...interface{}) { | ||||
| 	l.f(l.key, "msg", fmt.Sprintf(msg, args...)) | ||||
| } | ||||
|  | ||||
| func (l stdLoggerish) Fatalf(msg string, args ...interface{}) { | ||||
| 	l.log.Error(l.key, "msg", fmt.Sprintf(msg, args...)) | ||||
| 	panic("fatal error") // todo: does this make sense at all? | ||||
| } | ||||
|   | ||||
| @@ -64,7 +64,6 @@ type TracerConfig struct { | ||||
| } | ||||
|  | ||||
| func InitTracer(ctx context.Context, cfg *TracerConfig) (TpShutdownFunc, error) { | ||||
| 	// todo: setup environment from cfg | ||||
| 	return SetupSDK(ctx, cfg) | ||||
| } | ||||
|  | ||||
| @@ -72,6 +71,8 @@ func SetupSDK(ctx context.Context, cfg *TracerConfig) (shutdown TpShutdownFunc, | ||||
|  | ||||
| 	log := logger.Setup() | ||||
|  | ||||
| 	log.Warn("SetupSDK") | ||||
|  | ||||
| 	if serviceName := os.Getenv(svcNameKey); len(serviceName) == 0 { | ||||
| 		if len(cfg.ServiceName) > 0 { | ||||
| 			os.Setenv(svcNameKey, cfg.ServiceName) | ||||
| @@ -199,9 +200,11 @@ func newOLTPExporter(ctx context.Context, cfg *TracerConfig) (otelsdktrace.SpanE | ||||
| 			opts = append(opts, otlptracegrpc.WithTLSCredentials(credentials.NewTLS(tlsConfig))) | ||||
| 		} | ||||
| 		if len(cfg.Endpoint) > 0 { | ||||
| 			log.Info("adding option", "Endpoint", cfg.Endpoint) | ||||
| 			opts = append(opts, otlptracegrpc.WithEndpoint(cfg.Endpoint)) | ||||
| 		} | ||||
| 		if len(cfg.EndpointURL) > 0 { | ||||
| 			log.Info("adding option", "EndpointURL", cfg.EndpointURL) | ||||
| 			opts = append(opts, otlptracegrpc.WithEndpointURL(cfg.EndpointURL)) | ||||
| 		} | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user