main: also redirect Fatal logger to syslog on daemonization

The messages would still be collected via gocryptfs-logger,
but let's do it right.

Before:

  Oct 17 21:58:12 brikett gocryptfs[9926]: testing info
  Oct 17 21:58:12 brikett gocryptfs[9926]: testing warn
  Oct 17 21:58:12 brikett gocryptfs-9926-logger[9935]: testing fatal

After:

  Oct 17 22:00:53 brikett gocryptfs[10314]: testing info
  Oct 17 22:00:53 brikett gocryptfs[10314]: testing warn
  Oct 17 22:00:53 brikett gocryptfs[10314]: testing fatal
This commit is contained in:
Jakob Unterwurzacher 2018-10-17 22:01:37 +02:00
parent 0751b4e00a
commit 3cd892ccde

View File

@ -116,6 +116,7 @@ func doMount(args *argContainer) {
tlog.Info.SwitchToSyslog(syslog.LOG_USER | syslog.LOG_INFO)
tlog.Debug.SwitchToSyslog(syslog.LOG_USER | syslog.LOG_DEBUG)
tlog.Warn.SwitchToSyslog(syslog.LOG_USER | syslog.LOG_WARNING)
tlog.Fatal.SwitchToSyslog(syslog.LOG_USER | syslog.LOG_CRIT)
tlog.SwitchLoggerToSyslog(syslog.LOG_USER | syslog.LOG_WARNING)
// Daemons should redirect stdin, stdout and stderr
redirectStdFds()