summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sd_daemon/log.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/sd_daemon/log.go b/sd_daemon/log.go
index 1bdf65f..c8d8419 100644
--- a/sd_daemon/log.go
+++ b/sd_daemon/log.go
@@ -145,6 +145,20 @@ func (l *Logger) LogBytes(pri syslog.Priority, msg []byte) (n int, err error) {
return l.out.Write(l.buf)
}
+// Write writes a message with priority syslog.LOG_INFO to the log;
+// implementing io.Writer.
+func (l *Logger) Write(msg []byte) (n int, err error) {
+ n, err = l.LogBytes(syslog.LOG_INFO, msg)
+ return n, err
+}
+
+// WriteString writes a message with priority syslog.LOG_INFO to the
+// log; implementing io.WriteString's interface.
+func (l *Logger) WriteString(msg string) (n int, err error) {
+ n, err = l.LogString(syslog.LOG_INFO, msg)
+ return n, err
+}
+
type loggerWriter struct {
log *Logger
pri syslog.Priority
@@ -154,6 +168,10 @@ func (lw loggerWriter) Write(p []byte) (n int, err error) {
return lw.log.LogBytes(lw.pri, p)
}
+func (lw loggerWriter) WriteString(p string) (n int, err error) {
+ return lw.log.LogString(lw.pri, p)
+}
+
// Writer returns an io.Writer that writes messages with the specified
// priority to the log.
func (l *Logger) Writer(pri syslog.Priority) io.Writer {