aboutsummaryrefslogtreecommitdiff
path: root/cryptfs/log_go1.5.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2016-01-22 21:39:35 +0100
committerJakob Unterwurzacher2016-01-22 21:41:34 +0100
commitdf41183e9b86ffd152203f4addfb649319b2cb6e (patch)
tree44ddbd30eaccad593dd6bece188d2d2f7de71cd9 /cryptfs/log_go1.5.go
parent505fef5a3c514b1cfaa545ebeaa49127a6ec862e (diff)
Disable syslog in Go 1.4 and lower (method SetOutput does not exist)
Diffstat (limited to 'cryptfs/log_go1.5.go')
-rw-r--r--cryptfs/log_go1.5.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/cryptfs/log_go1.5.go b/cryptfs/log_go1.5.go
new file mode 100644
index 0000000..8daae9c
--- /dev/null
+++ b/cryptfs/log_go1.5.go
@@ -0,0 +1,17 @@
+// +build go1.5
+// = go 1.5 or higher
+
+package cryptfs
+
+import (
+ "log/syslog"
+)
+
+func (l *toggledLogger) SwitchToSyslog(p syslog.Priority) {
+ w, err := syslog.New(p, PROGRAM_NAME)
+ if err != nil {
+ Warn.Printf("Cannot switch 0x%02x to syslog: %v", p, err)
+ } else {
+ l.SetOutput(w)
+ }
+}