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/output/HttpdClient.cxx | |
parent | c53492a76a8a05825e1c7f699c05645eee891199 (diff) | |
download | mpd-060814daa83f6a94f5934464ae42a406c5c7e947.tar.gz mpd-060814daa83f6a94f5934464ae42a406c5c7e947.tar.xz mpd-060814daa83f6a94f5934464ae42a406c5c7e947.zip |
Log: new logging library API
Prepare to migrate away from GLib. Currently, we're still using GLib
as a backend.
Diffstat (limited to 'src/output/HttpdClient.cxx')
-rw-r--r-- | src/output/HttpdClient.cxx | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/src/output/HttpdClient.cxx b/src/output/HttpdClient.cxx index e776d526b..cbf396088 100644 --- a/src/output/HttpdClient.cxx +++ b/src/output/HttpdClient.cxx @@ -24,13 +24,11 @@ #include "Page.hxx" #include "IcyMetaDataServer.hxx" #include "system/SocketError.hxx" +#include "Log.hxx" #include <assert.h> #include <string.h> -#undef G_LOG_DOMAIN -#define G_LOG_DOMAIN "httpd_output" - HttpdClient::~HttpdClient() { if (state == RESPONSE) { @@ -80,7 +78,8 @@ HttpdClient::HandleLine(const char *line) if (state == REQUEST) { if (strncmp(line, "GET /", 5) != 0) { /* only GET is supported */ - g_warning("malformed request line from client"); + LogWarning(httpd_output_domain, + "malformed request line from client"); return false; } @@ -171,7 +170,9 @@ HttpdClient::SendResponse() ssize_t nbytes = SocketMonitor::Write(buffer, strlen(buffer)); if (gcc_unlikely(nbytes < 0)) { const SocketErrorMessage msg; - g_warning("failed to write to client: %s", (const char *)msg); + FormatWarning(httpd_output_domain, + "failed to write to client: %s", + (const char *)msg); Close(); return false; } @@ -278,8 +279,9 @@ HttpdClient::TryWrite() if (!IsSocketErrorClosed(e)) { SocketErrorMessage msg(e); - g_warning("failed to write to client: %s", - (const char *)msg); + FormatWarning(httpd_output_domain, + "failed to write to client: %s", + (const char *)msg); } Close(); @@ -304,8 +306,9 @@ HttpdClient::TryWrite() if (!IsSocketErrorClosed(e)) { SocketErrorMessage msg(e); - g_warning("failed to write to client: %s", - (const char *)msg); + FormatWarning(httpd_output_domain, + "failed to write to client: %s", + (const char *)msg); } Close(); @@ -326,8 +329,9 @@ HttpdClient::TryWrite() if (!IsSocketErrorClosed(e)) { SocketErrorMessage msg(e); - g_warning("failed to write to client: %s", - (const char *)msg); + FormatWarning(httpd_output_domain, + "failed to write to client: %s", + (const char *)msg); } Close(); @@ -399,7 +403,8 @@ BufferedSocket::InputResult HttpdClient::OnSocketInput(const void *data, size_t length) { if (state == RESPONSE) { - g_warning("unexpected input from client"); + LogWarning(httpd_output_domain, + "unexpected input from client"); LockClose(); return InputResult::CLOSED; } @@ -433,7 +438,7 @@ HttpdClient::OnSocketInput(const void *data, size_t length) void HttpdClient::OnSocketError(Error &&error) { - g_warning("error on HTTP client: %s", error.GetMessage()); + LogError(error); } void |