zen/core/zlog/write_locker.go

24 lines
276 B
Go
Raw Normal View History

2024-08-27 15:22:42 +07:00
package zlog
import (
"io"
"sync"
)
type WriteLocker interface {
io.Writer
sync.Locker
}
func WrapLocker(w io.Writer) WriteLocker {
if wl, ok := w.(WriteLocker); ok {
return wl
}
return &writeLocker{Writer: w}
}
type writeLocker struct {
io.Writer
sync.Mutex
}