summaryrefslogtreecommitdiff
path: root/internal/toggledlog/log_go1.5.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/toggledlog/log_go1.5.go')
-rw-r--r--internal/toggledlog/log_go1.5.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/internal/toggledlog/log_go1.5.go b/internal/toggledlog/log_go1.5.go
new file mode 100644
index 0000000..e8e71f9
--- /dev/null
+++ b/internal/toggledlog/log_go1.5.go
@@ -0,0 +1,17 @@
+// +build go1.5
+// = go 1.5 or higher
+
+package toggledlog
+
+import (
+ "log/syslog"
+)
+
+func (l *toggledLogger) SwitchToSyslog(p syslog.Priority) {
+ w, err := syslog.New(p, ProgramName)
+ if err != nil {
+ Warn.Printf("Cannot switch 0x%02x to syslog: %v", p, err)
+ } else {
+ l.SetOutput(w)
+ }
+}