From 060814daa83f6a94f5934464ae42a406c5c7e947 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 27 Sep 2013 22:31:24 +0200 Subject: Log: new logging library API Prepare to migrate away from GLib. Currently, we're still using GLib as a backend. --- src/ClientNew.cxx | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'src/ClientNew.cxx') diff --git a/src/ClientNew.cxx b/src/ClientNew.cxx index bc12bbf6a..e7bb6e1c2 100644 --- a/src/ClientNew.cxx +++ b/src/ClientNew.cxx @@ -26,6 +26,7 @@ #include "system/Resolver.hxx" #include "Permission.hxx" #include "util/Error.hxx" +#include "Log.hxx" #include #include @@ -40,9 +41,6 @@ #include #endif - -#define LOG_LEVEL_SECURE G_LOG_LEVEL_INFO - static const char GREETING[] = "OK MPD " PROTOCOL_VERSION "\n"; Client::Client(EventLoop &_loop, Partition &_partition, @@ -82,9 +80,9 @@ client_new(EventLoop &loop, Partition &partition, if (!hosts_access(&req)) { /* tcp wrappers says no */ - g_log(G_LOG_DOMAIN, LOG_LEVEL_SECURE, - "libwrap refused connection (libwrap=%s) from %s", - progname, hostaddr); + FormatWarning(client_domain, + "libwrap refused connection (libwrap=%s) from %s", + progname, hostaddr); g_free(hostaddr); close_socket(fd); @@ -97,7 +95,7 @@ client_new(EventLoop &loop, Partition &partition, ClientList &client_list = *partition.instance.client_list; if (client_list.IsFull()) { - g_warning("Max Connections Reached!"); + LogWarning(client_domain, "Max connections reached"); close_socket(fd); return; } @@ -110,8 +108,7 @@ client_new(EventLoop &loop, Partition &partition, client_list.Add(*client); remote = sockaddr_to_string(sa, sa_length, IgnoreError()); - g_log(G_LOG_DOMAIN, LOG_LEVEL_SECURE, - "[%u] opened from %s", client->num, remote); + FormatInfo(client_domain, "[%u] opened from %s", client->num, remote); g_free(remote); } @@ -122,6 +119,6 @@ Client::Close() SetExpired(); - g_log(G_LOG_DOMAIN, LOG_LEVEL_SECURE, "[%u] closed", num); + FormatInfo(client_domain, "[%u] closed", num); delete this; } -- cgit v1.2.3