summaryrefslogtreecommitdiffstats
path: root/src/socket
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-05-10 06:24:07 +0000
committerDavid Robillard <d@drobilla.net>2012-05-10 06:24:07 +0000
commit0c9e861caa8b1eed5068942edc35d5f91bac816e (patch)
treeb241856ddf49e1b1192f8ea442d1733d9d31b2f2 /src/socket
parent8ec295a0f2a40086ed83e8d2ad8ad38c8125bcb4 (diff)
downloadingen-0c9e861caa8b1eed5068942edc35d5f91bac816e.tar.gz
ingen-0c9e861caa8b1eed5068942edc35d5f91bac816e.tar.bz2
ingen-0c9e861caa8b1eed5068942edc35d5f91bac816e.zip
Work towards translatable strings and a cleaner log interface.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4338 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/socket')
-rw-r--r--src/socket/Socket.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/socket/Socket.cpp b/src/socket/Socket.cpp
index daeb6fa2..9c2a050c 100644
--- a/src/socket/Socket.cpp
+++ b/src/socket/Socket.cpp
@@ -29,7 +29,7 @@
#include "Socket.hpp"
-#define LOG(s) s << "[Socket] "
+#define LOG(s) (s("[Socket] "))
namespace Ingen {
namespace Socket {
@@ -96,8 +96,8 @@ Socket::set_addr(const std::string& uri)
struct addrinfo* ainfo;
int st = 0;
if ((st = getaddrinfo(host.c_str(), port.c_str(), NULL, &ainfo))) {
- LOG(Raul::error) << "Error in getaddrinfo: "
- << gai_strerror(st) << std::endl;
+ LOG(Raul::error)(Raul::fmt("Error in getaddrinfo: %1%\n")
+ % gai_strerror(st));
return false;
}
@@ -117,8 +117,8 @@ Socket::bind(const std::string& uri)
return true;
}
- LOG(Raul::error) << "Failed to bind " << _uri
- << ": " << strerror(errno) << std::endl;
+ LOG(Raul::error)(Raul::fmt("Failed to bind <%1%> (%2%)\n")
+ % _uri % strerror(errno));
return false;
}
@@ -129,8 +129,8 @@ Socket::connect(const std::string& uri)
return true;
}
- LOG(Raul::error) << "Failed to connect " << _uri
- << ": " << strerror(errno) << std::endl;
+ LOG(Raul::error)(Raul::fmt("Failed to connect <%1%> (%2%)\n")
+ % _uri % strerror(errno));
return false;
}
@@ -138,10 +138,10 @@ bool
Socket::listen()
{
if (::listen(_sock, 64) == -1) {
- LOG(Raul::error) << "Failed to listen on " << _uri << std::endl;
+ LOG(Raul::error)(Raul::fmt("Failed to listen on %1%\n") % _uri);
return false;
} else {
- LOG(Raul::info) << "Listening on " << _uri << std::endl;
+ LOG(Raul::info)(Raul::fmt("Listening on %1%\n") % _uri);
return true;
}
}
@@ -155,8 +155,8 @@ Socket::accept()
int conn = ::accept(_sock, client_addr, &client_addr_len);
if (conn == -1) {
- LOG(Raul::error) << "Error accepting connection: "
- << strerror(errno) << std::endl;
+ LOG(Raul::error)(Raul::fmt("Error accepting connection: %1%\n")
+ % strerror(errno));
return SharedPtr<Socket>();
}