Debian Codegraph @

exporter/debugexporter/internal/otlptext/sync.go

raw symbols SCIP
1 // Copyright The OpenTelemetry Authors
2 // SPDX-License-Identifier: Apache-2.0
3
4 package otlptext // import "go.opentelemetry.io/collector/exporter/debugexporter/internal/otlptext"
5
6 import (
7 "context"
8 "errors"
9 "os"
10
11 "go.uber.org/zap"
12 )
13
14 func LoggerSync(logger *zap.Logger) func(context.Context) error {
15 return func(context.Context) error {
16 // Currently Sync() return a different error depending on the OS.
17 // Since these are not actionable ignore them.
18 err := logger.Sync()
19 osErr := &os.PathError{}
20 if errors.As(err, &osErr) {
21 wrappedErr := osErr.Unwrap()
22 if knownSyncError(wrappedErr) {
23 err = nil
24 }
25 }
26 return err
27 }
28 }