glog/file.go

18 lines
202 B
Go
Raw Permalink Normal View History

2023-02-10 15:42:45 +08:00
package glog
import (
2024-01-21 21:14:35 +08:00
"os"
"sync"
2023-02-10 15:42:45 +08:00
)
type File struct {
2024-01-21 21:14:35 +08:00
file *os.File
sync.Mutex
2023-02-10 15:42:45 +08:00
}
func (f *File) Write(p []byte) (n int, err error) {
2024-01-21 21:14:35 +08:00
f.Lock()
defer f.Unlock()
return f.file.Write(p)
2023-02-10 15:42:45 +08:00
}