Skip to content

Commit

Permalink
add siserlogger.File.Close()
Browse files Browse the repository at this point in the history
  • Loading branch information
kjk committed Mar 31, 2024
1 parent db09728 commit 6114081
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions siserlogger/siserlogger.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ import (
)

type File struct {
siser *siser.Writer
file *filerotate.File
name string
// name of the record written to siser log
RecName string
mu sync.Mutex
dir string

siser *siser.Writer
file *filerotate.File
name string
mu sync.Mutex
dir string
}

func NewDaily(dir string, name string, didRotateFn func(path string)) (*File, error) {
Expand Down Expand Up @@ -55,3 +57,10 @@ func (f *File) Write(d []byte) error {
}
return err
}

func (f *File) Close() error {
err := f.file.Close()
f.siser = nil
f.file = nil
return err
}

0 comments on commit 6114081

Please sign in to comment.