Use Client_find_by_session() instead of a few open-coded loops.
[umurmur.git] / src / log.c
index ebb5cd1c0ae1e4b4965da971df41a3484f538928..91ec5b023ed40e0de5d8e407553114fc0f9d78f7 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -39,6 +39,7 @@
 
 #include "log.h"
 #include "conf.h"
+#include "util.h"
 
 #define STRSIZE 254
 
@@ -190,11 +191,14 @@ void Log_info_client(client_t *client, const char *logstring, ...)
        offset += vsnprintf(&buf[offset], STRSIZE - offset, logstring, argp);
        va_end(argp);
 
+       char *clientAddressString = Util_clientAddressToString(client);
        offset += snprintf(&buf[offset], STRSIZE - offset, " - [%d] %s@%s:%d",
-                                          client->sessionId,
-                                          client->username == NULL ? "" : client->username,
-                                          inet_ntoa(client->remote_tcp.sin_addr),
-                                          ntohs(client->remote_tcp.sin_port));
+               client->sessionId,
+               client->username == NULL ? "" : client->username,
+               clientAddressString,
+               Util_clientAddressToPortTCP(client));
+       free(clientAddressString);
+
        if (termprint)
                fprintf(stderr, "%s\n", buf);
        else if (logfile)