tlog: stop embedding log.Logger to prevent mistakes
A few places have called tlog.Warn.Print, which directly calls into log.Logger due to embedding, losing all features of tlog. Stop embedding log.Logger to make sure the internal functions cannot be called accidentially and fix (several!) instances that did.
This commit is contained in:
parent
ac8f8bf432
commit
b96e3ee271
@ -163,7 +163,7 @@ func (c *CryptoCore) Wipe() {
|
||||
w := c.AEADCipher.(wiper)
|
||||
w.Wipe()
|
||||
} else {
|
||||
tlog.Debug.Print("CryptoCore.Wipe: Only nil'ing stdlib refs")
|
||||
tlog.Debug.Printf("CryptoCore.Wipe: Only nil'ing stdlib refs")
|
||||
}
|
||||
// We have no access to the keys (or key-equivalents) stored inside the
|
||||
// Go stdlib. Best we can is to nil the references and force a GC.
|
||||
|
@ -39,7 +39,7 @@ var allocateWarnOnce sync.Once
|
||||
func (f *file) Allocate(off uint64, sz uint64, mode uint32) fuse.Status {
|
||||
if mode != FALLOC_DEFAULT && mode != FALLOC_FL_KEEP_SIZE {
|
||||
f := func() {
|
||||
tlog.Warn.Print("fallocate: only mode 0 (default) and 1 (keep size) are supported")
|
||||
tlog.Warn.Printf("fallocate: only mode 0 (default) and 1 (keep size) are supported")
|
||||
}
|
||||
allocateWarnOnce.Do(f)
|
||||
return fuse.Status(syscall.EOPNOTSUPP)
|
||||
|
@ -53,7 +53,7 @@ type toggledLogger struct {
|
||||
prefix string
|
||||
postfix string
|
||||
|
||||
*log.Logger
|
||||
Logger *log.Logger
|
||||
}
|
||||
|
||||
func (l *toggledLogger) Printf(format string, v ...interface{}) {
|
||||
@ -125,7 +125,7 @@ func (l *toggledLogger) SwitchToSyslog(p syslog.Priority) {
|
||||
if err != nil {
|
||||
Warn.Printf("SwitchToSyslog: %v", err)
|
||||
} else {
|
||||
l.SetOutput(w)
|
||||
l.Logger.SetOutput(w)
|
||||
}
|
||||
}
|
||||
|
||||
|
4
mount.go
4
mount.go
@ -89,7 +89,7 @@ func doMount(args *argContainer) {
|
||||
defer func() {
|
||||
err = sock.Close()
|
||||
if err != nil {
|
||||
tlog.Warn.Print(err)
|
||||
tlog.Warn.Printf("ctlsock close: %v", err)
|
||||
}
|
||||
}()
|
||||
}
|
||||
@ -378,7 +378,7 @@ func handleSigint(srv *fuse.Server, mountpoint string) {
|
||||
<-ch
|
||||
err := srv.Unmount()
|
||||
if err != nil {
|
||||
tlog.Warn.Print(err)
|
||||
tlog.Warn.Printf("handleSigint: srv.Unmount returned %v", err)
|
||||
if runtime.GOOS == "linux" {
|
||||
// MacOSX does not support lazy unmount
|
||||
tlog.Info.Printf("Trying lazy unmount")
|
||||
|
Loading…
Reference in New Issue
Block a user