diff options
author | Max Kellermann <max@duempel.org> | 2013-09-27 22:31:24 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-10-02 08:57:55 +0200 |
commit | 060814daa83f6a94f5934464ae42a406c5c7e947 (patch) | |
tree | f636ec6cdbb8e52fda6db987d2a28fc73c7b94b4 /src/event/ServerSocket.cxx | |
parent | c53492a76a8a05825e1c7f699c05645eee891199 (diff) |
Log: new logging library API
Prepare to migrate away from GLib. Currently, we're still using GLib
as a backend.
Diffstat (limited to 'src/event/ServerSocket.cxx')
-rw-r--r-- | src/event/ServerSocket.cxx | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/event/ServerSocket.cxx b/src/event/ServerSocket.cxx index 342acc04e..c3dbbad3d 100644 --- a/src/event/ServerSocket.cxx +++ b/src/event/ServerSocket.cxx @@ -31,6 +31,7 @@ #include "system/fd_util.h" #include "util/Error.hxx" #include "util/Domain.hxx" +#include "Log.hxx" #include <glib.h> @@ -52,9 +53,6 @@ #include <netdb.h> #endif -#undef G_LOG_DOMAIN -#define G_LOG_DOMAIN "listen" - #define DEFAULT_PORT 6600 class OneServerSocket final : private SocketMonitor { @@ -167,14 +165,16 @@ OneServerSocket::Accept() &peer_address_length); if (peer_fd < 0) { const SocketErrorMessage msg; - g_warning("accept() failed: %s", (const char *)msg); + FormatError(server_socket_domain, + "accept() failed: %s", (const char *)msg); return; } if (socket_keepalive(peer_fd)) { const SocketErrorMessage msg; - g_warning("Could not set TCP keepalive option: %s", - (const char *)msg); + FormatError(server_socket_domain, + "Could not set TCP keepalive option: %s", + (const char *)msg); } parent.OnAccept(peer_fd, @@ -241,11 +241,12 @@ ServerSocket::Open(Error &error) if (good != nullptr && good->GetSerial() == i.GetSerial()) { char *address_string = i.ToString(); char *good_string = good->ToString(); - g_warning("bind to '%s' failed: %s " - "(continuing anyway, because " - "binding to '%s' succeeded)", - address_string, error2.GetMessage(), - good_string); + FormatWarning(server_socket_domain, + "bind to '%s' failed: %s " + "(continuing anyway, because " + "binding to '%s' succeeded)", + address_string, error2.GetMessage(), + good_string); g_free(address_string); g_free(good_string); } else if (bad == nullptr) { |