summaryrefslogtreecommitdiff
path: root/src/nslcd_systemd/nslcd_systemd.go
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2015-09-12 09:29:41 -0600
committerLuke Shumaker <lukeshu@sbcglobal.net>2015-09-12 09:29:41 -0600
commitf0302e1ac1a12711a9f49c3d7a62bcdfcaca7eed (patch)
tree1796becfcf6061c67c547faae9be6f269a868d88 /src/nslcd_systemd/nslcd_systemd.go
parentb190157b8c568922f7f9b4039b67a34862fa9f54 (diff)
Clean up log messages
Diffstat (limited to 'src/nslcd_systemd/nslcd_systemd.go')
-rw-r--r--src/nslcd_systemd/nslcd_systemd.go19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/nslcd_systemd/nslcd_systemd.go b/src/nslcd_systemd/nslcd_systemd.go
index 6fb29a9..7caee26 100644
--- a/src/nslcd_systemd/nslcd_systemd.go
+++ b/src/nslcd_systemd/nslcd_systemd.go
@@ -25,11 +25,11 @@ func get_socket() (socket net.Listener, err error) {
err = nil
fds := sd.ListenFds(true)
if fds == nil {
- err = fmt.Errorf("failed to aquire sockets from systemd")
+ err = fmt.Errorf("Failed to aquire sockets from systemd")
return
}
if len(fds) != 1 {
- err = fmt.Errorf("wrong number of sockets from systemd: expected %d but got %d", 1, len(fds))
+ err = fmt.Errorf("Wrong number of sockets from systemd: expected %d but got %d", 1, len(fds))
return
}
socket, err = net.FileListener(fds[0])
@@ -52,14 +52,14 @@ func handler(conn *net.UnixConn, backend nslcd_proto.Backend) {
defer conn.Close()
cred, err := getpeercred(conn)
if err != nil {
- logger.Debug("connection from unknown client")
+ logger.Debug("Connection from unknown client")
} else {
- logger.Debug("connection from pid=%v uid=%v gid=%v",
+ logger.Debug("Connection from pid=%v uid=%v gid=%v",
cred.Pid, cred.Uid, cred.Gid)
}
err = nslcd_proto.HandleRequest(backend, conn, conn, cred)
if err != nil {
- logger.Debug("Error while handling request: %v", err)
+ logger.Notice("Error while handling request: %v", err)
}
}
@@ -79,7 +79,7 @@ func Main(backend Backend) uint8 {
err = backend.Init()
if err != nil {
- logger.Err("%s", err.Error())
+ logger.Err("Could not initialize backend: %v", err)
sd.Notify(false, "STOPPING=1")
return lsb.EXIT_FAILURE
}
@@ -87,7 +87,7 @@ func Main(backend Backend) uint8 {
socket, err = get_socket()
if err != nil {
- logger.Err("%s", err.Error())
+ logger.Err("%v", err)
sd.Notify(false, "STOPPING=1")
return lsb.EXIT_NOTRUNNING
}
@@ -97,7 +97,7 @@ func Main(backend Backend) uint8 {
for {
conn, err := socket.Accept()
if err != nil {
- logger.Notice("Accept: %s", err.Error())
+ logger.Notice("Could not accept connection: %v", err)
}
sock <- conn.(*net.UnixConn)
}
@@ -112,12 +112,13 @@ Loop:
case sig := <-sigs:
switch sig {
case syscall.SIGTERM:
+ logger.Notice("Received SIGTERM, shutting down")
break Loop
case syscall.SIGHUP:
sd.Notify(false, "RELOADING=1")
err := backend.Reload()
if err != nil {
- logger.Notice("Reload: %s", err.Error())
+ logger.Notice("Could not reload backend: %s", err.Error())
exit = lsb.EXIT_NOTRUNNING
break Loop
}