Skip to content

Commit

Permalink
Merge pull request #31 from Trendyol/fix/logger-sync
Browse files Browse the repository at this point in the history
Fix/logger sync
  • Loading branch information
ahmetcanozcan authored Sep 1, 2024
2 parents 227cb12 + 1857745 commit 02f050c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
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
6 changes: 3 additions & 3 deletions option.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import (
)

type configOptions struct {
disabled bool
path string
referencePaths map[string]string
path string
disabled bool
}

type options struct {
timeout time.Duration
configOptions configOptions
timeout time.Duration
}

func getOptions(opt ...Option) *options {
Expand Down

0 comments on commit 02f050c

Please sign in to comment.