zen/core/zlog/write_locker.go
2024-08-27 15:22:42 +07:00

24 lines
276 B
Go

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
}