fsck: redirect go-fuse noise to syslog
This commit is contained in:
parent
5da20da977
commit
0650a512bb
7
fsck.go
7
fsck.go
@ -253,6 +253,7 @@ func (ck *fsckObj) xattrs(relPath string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// entrypoint from main()
|
||||||
func fsck(args *argContainer) (exitcode int) {
|
func fsck(args *argContainer) (exitcode int) {
|
||||||
if args.reverse {
|
if args.reverse {
|
||||||
tlog.Fatal.Printf("Running -fsck with -reverse is not supported")
|
tlog.Fatal.Printf("Running -fsck with -reverse is not supported")
|
||||||
@ -274,6 +275,12 @@ func fsck(args *argContainer) (exitcode int) {
|
|||||||
watchDone: make(chan struct{}),
|
watchDone: make(chan struct{}),
|
||||||
seenInodes: make(map[uint64]struct{}),
|
seenInodes: make(map[uint64]struct{}),
|
||||||
}
|
}
|
||||||
|
if args.quiet {
|
||||||
|
// go-fuse throws a lot of these:
|
||||||
|
// writer: Write/Writev failed, err: 2=no such file or directory. opcode: INTERRUPT
|
||||||
|
// This is ugly and causes failures in xfstests. Hide them away in syslog.
|
||||||
|
tlog.SwitchLoggerToSyslog()
|
||||||
|
}
|
||||||
// Mount
|
// Mount
|
||||||
srv := initGoFuse(pfs, args)
|
srv := initGoFuse(pfs, args)
|
||||||
// Handle SIGINT & SIGTERM
|
// Handle SIGINT & SIGTERM
|
||||||
|
@ -136,6 +136,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SwitchToSyslog redirects the output of this logger to syslog.
|
// SwitchToSyslog redirects the output of this logger to syslog.
|
||||||
|
// p = facility | severity
|
||||||
func (l *toggledLogger) SwitchToSyslog(p syslog.Priority) {
|
func (l *toggledLogger) SwitchToSyslog(p syslog.Priority) {
|
||||||
w, err := syslog.New(p, ProgramName)
|
w, err := syslog.New(p, ProgramName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -150,7 +151,8 @@ func (l *toggledLogger) SwitchToSyslog(p syslog.Priority) {
|
|||||||
|
|
||||||
// SwitchLoggerToSyslog redirects the default log.Logger that the go-fuse lib uses
|
// SwitchLoggerToSyslog redirects the default log.Logger that the go-fuse lib uses
|
||||||
// to syslog.
|
// to syslog.
|
||||||
func SwitchLoggerToSyslog(p syslog.Priority) {
|
func SwitchLoggerToSyslog() {
|
||||||
|
p := syslog.LOG_USER | syslog.LOG_WARNING
|
||||||
w, err := syslog.New(p, ProgramName)
|
w, err := syslog.New(p, ProgramName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Warn.Printf("SwitchLoggerToSyslog: %v", err)
|
Warn.Printf("SwitchLoggerToSyslog: %v", err)
|
||||||
|
2
mount.go
2
mount.go
@ -143,7 +143,7 @@ func doMount(args *argContainer) {
|
|||||||
tlog.Debug.SwitchToSyslog(syslog.LOG_USER | syslog.LOG_DEBUG)
|
tlog.Debug.SwitchToSyslog(syslog.LOG_USER | syslog.LOG_DEBUG)
|
||||||
tlog.Warn.SwitchToSyslog(syslog.LOG_USER | syslog.LOG_WARNING)
|
tlog.Warn.SwitchToSyslog(syslog.LOG_USER | syslog.LOG_WARNING)
|
||||||
tlog.Fatal.SwitchToSyslog(syslog.LOG_USER | syslog.LOG_CRIT)
|
tlog.Fatal.SwitchToSyslog(syslog.LOG_USER | syslog.LOG_CRIT)
|
||||||
tlog.SwitchLoggerToSyslog(syslog.LOG_USER | syslog.LOG_WARNING)
|
tlog.SwitchLoggerToSyslog()
|
||||||
// Daemons should redirect stdin, stdout and stderr
|
// Daemons should redirect stdin, stdout and stderr
|
||||||
redirectStdFds()
|
redirectStdFds()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user