aboutsummaryrefslogtreecommitdiff
path: root/daemonize.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2016-01-21 22:59:11 +0100
committerJakob Unterwurzacher2016-01-21 22:59:11 +0100
commitd1631696556cb6460db1d6eedf9fbc3015433b1c (patch)
treea2665626d35a55d82cc41bdc0dce28710e1fa01f /daemonize.go
parent9bab220a1b5a10c00c314b15f4c9f879f1473707 (diff)
Wrap Logger to make disabling output more efficient
Instead of using SetOutput(ioutil.Discard), which means that Printf is still called for every debug message, use a simple and fast boolean check. Streaming write performance improves from 86 to 93 MB/s.
Diffstat (limited to 'daemonize.go')
-rw-r--r--daemonize.go14
1 files changed, 0 insertions, 14 deletions
diff --git a/daemonize.go b/daemonize.go
index 7d00288..e227942 100644
--- a/daemonize.go
+++ b/daemonize.go
@@ -2,14 +2,10 @@ package main
import (
"fmt"
- "log"
- "log/syslog"
"os"
"os/exec"
"os/signal"
"syscall"
-
- "github.com/rfjakob/gocryptfs/cryptfs"
)
// The child sends us USR1 if the mount was successful
@@ -50,13 +46,3 @@ func forkChild() {
// The child exited with 0 - let's do the same.
os.Exit(0)
}
-
-// Switch one Logger to syslog
-func switchToSyslog(l *log.Logger, p syslog.Priority) {
- w, err := syslog.New(p, PROGRAM_NAME)
- if err != nil {
- cryptfs.Warn.Printf("Cannot switch 0x%02x to syslog: %v", p, err)
- } else {
- l.SetOutput(w)
- }
-}