MCPcopy
hub / github.com/grpc/grpc-go / newCloudLoggingExporter

Function newCloudLoggingExporter

gcp/observability/exporting.go:64–78  ·  view source on GitHub ↗
(ctx context.Context, config *config)

Source from the content-addressed store, hash-verified

62}
63
64func newCloudLoggingExporter(ctx context.Context, config *config) (loggingExporter, error) {
65 c, err := gcplogging.NewClient(ctx, fmt.Sprintf("projects/%v", config.ProjectID), cOptsDisableLogTrace...)
66 if err != nil {
67 return nil, fmt.Errorf("failed to create cloudLoggingExporter: %v", err)
68 }
69 defer logger.Infof("Successfully created cloudLoggingExporter")
70 if len(config.Labels) != 0 {
71 logger.Infof("Adding labels: %+v", config.Labels)
72 }
73 return &cloudLoggingExporter{
74 projectID: config.ProjectID,
75 client: c,
76 logger: c.Logger("microservices.googleapis.com/observability/grpc", gcplogging.CommonLabels(config.Labels), gcplogging.BufferedByteLimit(1024*1024*50), gcplogging.DelayThreshold(time.Second*10)),
77 }, nil
78}
79
80func (cle *cloudLoggingExporter) EmitGcpLoggingEntry(entry gcplogging.Entry) {
81 cle.logger.Log(entry)

Callers

nothing calls this directly

Calls 3

NewClientMethod · 0.80
ErrorfMethod · 0.65
InfofMethod · 0.65

Tested by

no test coverage detected