mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Rework log messages
Former-commit-id: eac93c0fd78fdf353e940d08df3cabf0b962a3e2
This commit is contained in:
@@ -16,7 +16,7 @@ ProtoConnection::ProtoConnection(const std::string & a) :
|
||||
QStringList parts = address.split(":");
|
||||
if (parts.size() != 2)
|
||||
{
|
||||
throw std::runtime_error(QString("Wrong address: unable to parse address (%1)").arg(address).toStdString());
|
||||
throw std::runtime_error(QString("PROTOCONNECTION ERROR: Wrong address: Unable to parse address (%1)").arg(address).toStdString());
|
||||
}
|
||||
_host = parts[0];
|
||||
|
||||
@@ -24,11 +24,11 @@ ProtoConnection::ProtoConnection(const std::string & a) :
|
||||
_port = parts[1].toUShort(&ok);
|
||||
if (!ok)
|
||||
{
|
||||
throw std::runtime_error(QString("Wrong address: Unable to parse the port number (%1)").arg(parts[1]).toStdString());
|
||||
throw std::runtime_error(QString("PROTOCONNECTION ERROR: Wrong port: Unable to parse the port number (%1)").arg(parts[1]).toStdString());
|
||||
}
|
||||
|
||||
// try to connect to host
|
||||
std::cout << "Connecting to Hyperion: " << _host.toStdString() << ":" << _port << std::endl;
|
||||
std::cout << "PROTOCONNECTION INFO: Connecting to Hyperion: " << _host.toStdString() << ":" << _port << std::endl;
|
||||
connectToHost();
|
||||
|
||||
// start the connection timer
|
||||
@@ -116,11 +116,11 @@ void ProtoConnection::sendMessage(const proto::HyperionRequest &message)
|
||||
switch (_socket.state() )
|
||||
{
|
||||
case QAbstractSocket::UnconnectedState:
|
||||
std::cout << "No connection to Hyperion: " << _host.toStdString() << ":" << _port << std::endl;
|
||||
std::cout << "PROTOCONNECTION INFO: No connection to Hyperion: " << _host.toStdString() << ":" << _port << std::endl;
|
||||
break;
|
||||
|
||||
case QAbstractSocket::ConnectedState:
|
||||
std::cout << "Connected to Hyperion: " << _host.toStdString() << ":" << _port << std::endl;
|
||||
std::cout << "PROTOCONNECTION INFO: Connected to Hyperion: " << _host.toStdString() << ":" << _port << std::endl;
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -154,7 +154,7 @@ void ProtoConnection::sendMessage(const proto::HyperionRequest &message)
|
||||
count += _socket.write(reinterpret_cast<const char *>(serializedMessage.data()), length);
|
||||
if (!_socket.waitForBytesWritten())
|
||||
{
|
||||
std::cerr << "Error while writing data to host" << std::endl;
|
||||
std::cerr << "PROTOCONNECTION ERROR: Error while writing data to host" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ void ProtoConnection::sendMessage(const proto::HyperionRequest &message)
|
||||
// receive reply
|
||||
if (!_socket.waitForReadyRead())
|
||||
{
|
||||
std::cerr << "Error while reading data from host" << std::endl;
|
||||
std::cerr << "PROTOCONNECTION ERROR: Error while reading data from host" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -202,11 +202,11 @@ bool ProtoConnection::parseReply(const proto::HyperionReply &reply)
|
||||
{
|
||||
if (reply.has_error())
|
||||
{
|
||||
throw std::runtime_error("Error: " + reply.error());
|
||||
throw std::runtime_error("PROTOCONNECTION ERROR: " + reply.error());
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::runtime_error("Error: No error info");
|
||||
throw std::runtime_error("PROTOCONNECTION ERROR: No error info");
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -19,7 +19,7 @@ ProtoServer::ProtoServer(Hyperion *hyperion, uint16_t port) :
|
||||
|
||||
for (int i = 0; i < slaves.size(); ++i) {
|
||||
if ( QString("127.0.0.1:%1").arg(port) == slaves.at(i) ) {
|
||||
throw std::runtime_error("Loop between proto server and forwarder detected. Fix your config!");
|
||||
throw std::runtime_error("PROTOSERVER ERROR: Loop between proto server and forwarder detected. Fix your config!");
|
||||
}
|
||||
|
||||
ProtoConnection* p = new ProtoConnection(slaves.at(i).toLocal8Bit().constData());
|
||||
@@ -29,7 +29,7 @@ ProtoServer::ProtoServer(Hyperion *hyperion, uint16_t port) :
|
||||
|
||||
if (!_server.listen(QHostAddress::Any, port))
|
||||
{
|
||||
throw std::runtime_error("Proto server could not bind to port");
|
||||
throw std::runtime_error("PROTOSERVER ERROR: Could not bind to port");
|
||||
}
|
||||
|
||||
// Set trigger for incoming connections
|
||||
@@ -57,7 +57,7 @@ void ProtoServer::newConnection()
|
||||
|
||||
if (socket != nullptr)
|
||||
{
|
||||
std::cout << "New proto connection" << std::endl;
|
||||
std::cout << "PROTOSERVER INFO: New connection" << std::endl;
|
||||
ProtoClientConnection * connection = new ProtoClientConnection(socket, _hyperion);
|
||||
_openConnections.insert(connection);
|
||||
|
||||
@@ -82,7 +82,7 @@ void ProtoServer::sendImageToProtoSlaves(int priority, const Image<ColorRgb> & i
|
||||
|
||||
void ProtoServer::closedConnection(ProtoClientConnection *connection)
|
||||
{
|
||||
std::cout << "Proto connection closed" << std::endl;
|
||||
std::cout << "PROTOSERVER INFO: Connection closed" << std::endl;
|
||||
_openConnections.remove(connection);
|
||||
|
||||
// schedule to delete the connection object
|
||||
|
Reference in New Issue
Block a user