summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sd_daemon/log.go12
-rw-r--r--sd_daemon/log_test.go8
-rwxr-xr-xsd_daemon/log_util.go.gen2
3 files changed, 11 insertions, 11 deletions
diff --git a/sd_daemon/log.go b/sd_daemon/log.go
index dc77907..1bdf65f 100644
--- a/sd_daemon/log.go
+++ b/sd_daemon/log.go
@@ -74,9 +74,9 @@ func appendPrefix(buf []byte, n syslog.Priority) []byte {
return append(buf, b[i:]...)
}
-// WriteString writes a message with the specified priority to the
+// LogString writes a message with the specified priority to the
// log.
-func (l *Logger) WriteString(pri syslog.Priority, msg string) (n int, err error) {
+func (l *Logger) LogString(pri syslog.Priority, msg string) (n int, err error) {
l.mu.Lock()
defer l.mu.Unlock()
@@ -111,10 +111,10 @@ func (l *Logger) WriteString(pri syslog.Priority, msg string) (n int, err error)
return l.out.Write(l.buf)
}
-// WriteBytes writes a message with the specified priority to the
+// LogBytes writes a message with the specified priority to the
// log.
-func (l *Logger) WriteBytes(pri syslog.Priority, msg []byte) (n int, err error) {
- // Copy/pasted from WriteString and
+func (l *Logger) LogBytes(pri syslog.Priority, msg []byte) (n int, err error) {
+ // Copy/pasted from LogString and
// * `strings.` -> `bytes.`
// * `"\n"` -> `[]byte{'\n'}`
l.mu.Lock()
@@ -151,7 +151,7 @@ type loggerWriter struct {
}
func (lw loggerWriter) Write(p []byte) (n int, err error) {
- return lw.log.WriteBytes(lw.pri, p)
+ return lw.log.LogBytes(lw.pri, p)
}
// Writer returns an io.Writer that writes messages with the specified
diff --git a/sd_daemon/log_test.go b/sd_daemon/log_test.go
index 2f835a8..fe2f6f6 100644
--- a/sd_daemon/log_test.go
+++ b/sd_daemon/log_test.go
@@ -54,17 +54,17 @@ func TestLog(t *testing.T) {
for in, out := range testcases {
written = nil
- n, err := log.WriteString(in.pri, in.msg)
+ n, err := log.LogString(in.pri, in.msg)
if n != len(out) || string(written) != out || err != nil {
- t.Errorf("WriteString(%#v, %#v)\n -> expected:{%#v, %#v, %#v}\n -> got:{%#v, %#v, %#v}\n",
+ t.Errorf("LogString(%#v, %#v)\n -> expected:{%#v, %#v, %#v}\n -> got:{%#v, %#v, %#v}\n",
in.pri, in.msg,
len(out), nil, out,
n, err, string(written))
}
written = nil
- n, err = log.WriteBytes(in.pri, []byte(in.msg))
+ n, err = log.LogBytes(in.pri, []byte(in.msg))
if n != len(out) || string(written) != out || err != nil {
- t.Errorf("WriteBytes(%#v, %#v)\n -> expected:{%#v, %#v, %#v}\n -> got:{%#v, %#v, %#v}\n",
+ t.Errorf("LogBytes(%#v, %#v)\n -> expected:{%#v, %#v, %#v}\n -> got:{%#v, %#v, %#v}\n",
in.pri, in.msg,
len(out), nil, out,
n, err, string(written))
diff --git a/sd_daemon/log_util.go.gen b/sd_daemon/log_util.go.gen
index 3ca63dc..9bfc28c 100755
--- a/sd_daemon/log_util.go.gen
+++ b/sd_daemon/log_util.go.gen
@@ -28,7 +28,7 @@ EOF
cat <<EOF
// $pri writes a message with priority syslog.LOG_${pri^^} to the log.
func (l *Logger) $pri(msg string) error {
- _, err := l.WriteString(syslog.LOG_${pri^^}, msg)
+ _, err := l.LogString(syslog.LOG_${pri^^}, msg)
return err
}