Skip to content

Commit

Permalink
fix(logger): ignore known uber-zap error on sync method
Browse files Browse the repository at this point in the history
  • Loading branch information
ispiroglu committed Aug 31, 2024
1 parent 227cb12 commit 5f9fdad
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package logger
import (
"context"
"errors"
"io/fs"
"syscall"

"github.com/Trendyol/chaki/util/appctx"
"go.uber.org/zap"
Expand Down Expand Up @@ -45,7 +47,14 @@ func New() *zap.Logger {
}

func Sync() error {
return New().Sync()
err := New().Sync()

var pathErr *fs.PathError
if errors.Is(err, syscall.ENOTTY) || errors.As(err, &pathErr) {
return nil
}

return err
}

func From(ctx context.Context) *zap.Logger {
Expand Down

0 comments on commit 5f9fdad

Please sign in to comment.