2019-09-03 21:13:33 +00:00
|
|
|
package logger
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"sync"
|
|
|
|
)
|
|
|
|
|
|
|
|
type logSyncWrapper struct {
|
2020-07-24 21:39:38 +00:00
|
|
|
sync.Mutex
|
2019-09-03 21:13:33 +00:00
|
|
|
output *os.File
|
|
|
|
}
|
|
|
|
|
2020-07-24 21:39:38 +00:00
|
|
|
func (l *logSyncWrapper) Write(b []byte) (n int, err error) {
|
|
|
|
l.Lock()
|
|
|
|
defer l.Unlock()
|
2019-09-03 21:13:33 +00:00
|
|
|
return l.output.Write(b)
|
|
|
|
}
|