mirror of
https://github.com/hanzoai/telemetry.git
synced 2026-10-30 20:01:49 +00:00
Depends on https://github.com/open-telemetry/opentelemetry-collector/pull/11371 Signed-off-by: Bogdan Drutu <[email protected]>
29 lines
648 B
Go
29 lines
648 B
Go
// Copyright The OpenTelemetry Authors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package otlptext // import "go.opentelemetry.io/collector/exporter/debugexporter/internal/otlptext"
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"os"
|
|
|
|
"go.uber.org/zap"
|
|
)
|
|
|
|
func LoggerSync(logger *zap.Logger) func(context.Context) error {
|
|
return func(context.Context) error {
|
|
// Currently Sync() return a different error depending on the OS.
|
|
// Since these are not actionable ignore them.
|
|
err := logger.Sync()
|
|
osErr := &os.PathError{}
|
|
if errors.As(err, &osErr) {
|
|
wrappedErr := osErr.Unwrap()
|
|
if knownSyncError(wrappedErr) {
|
|
err = nil
|
|
}
|
|
}
|
|
return err
|
|
}
|
|
}
|