Belle II Software light-2406-ragdoll
|
Log Connection to send the log message as JSON to a UDP server. More...
#include <LogConnectionUDP.h>
Public Member Functions | |
LogConnectionUDP (const std::string &hostname, unsigned short port) | |
Create a new UDP log connection with the hostname (as name or IP) and the port to connect to. | |
~LogConnectionUDP () override | |
Close the socket on destruction. | |
bool | sendMessage (const LogMessage &message) final |
Send the log message as JSON to the UDP server. | |
bool | isConnected () final |
there is no way to check if a UDP connection is fine, so we just return True always | |
virtual void | finalizeOnAbort () |
Called just before the system exists after a fatal error. | |
Private Attributes | |
boost::asio::io_service | m_ioservice |
asio service for handling the requests | |
boost::asio::ip::udp::socket | m_socket |
the socket to the UDP server | |
boost::asio::ip::udp::endpoint | m_remoteEndpoint |
the remote endpoint we send to | |
Log Connection to send the log message as JSON to a UDP server.
Definition at line 21 of file LogConnectionUDP.h.
LogConnectionUDP | ( | const std::string & | hostname, |
unsigned short | port | ||
) |
Create a new UDP log connection with the hostname (as name or IP) and the port to connect to.
if the hostname can not be resolved, this will throw an exception so dereferencing the result is always safe
Definition at line 17 of file LogConnectionUDP.cc.
|
override |
Close the socket on destruction.
Definition at line 42 of file LogConnectionUDP.cc.
|
inlinevirtualinherited |
Called just before the system exists after a fatal error.
Can be used to flush the output or close the file
Reimplemented in LogConnectionConsole, LogConnectionFilter, LogConnectionJSON, and LogConnectionTxtFile.
Definition at line 48 of file LogConnectionBase.h.
|
finalvirtual |
there is no way to check if a UDP connection is fine, so we just return True always
Implements LogConnectionBase.
Definition at line 27 of file LogConnectionUDP.cc.
|
finalvirtual |
Send the log message as JSON to the UDP server.
Implements LogConnectionBase.
Definition at line 32 of file LogConnectionUDP.cc.
|
private |
asio service for handling the requests
Definition at line 33 of file LogConnectionUDP.h.
|
private |
the remote endpoint we send to
Definition at line 37 of file LogConnectionUDP.h.
|
private |
the socket to the UDP server
Definition at line 35 of file LogConnectionUDP.h.