36#ifndef _UTILS_TCPLOGGING_HXX_
37#define _UTILS_TCPLOGGING_HXX_
121 b->data()->data.reserve(size + 1);
122 b->data()->data.assign(buf, size);
123 b->data()->data.push_back(
'\n');
141 std::placeholders::_1))
173 fd_ = ::open(name, O_WRONLY);
int bind(int socket, const struct sockaddr *address, socklen_t address_len)
Bind a name to a socket.
#define STATE(_fn)
Turns a function name into an argument to be supplied to functions expecting a state.
void log_output(char *buf, int size)
Implementation of the weak symbol to output log lines.
Base class that can receive log buffers from the FdLogging implementation and prints them to a file d...
Action write_done()
Called when the FD write is completed.
FdLoggingServer(Service *service)
Constructor.
int fd_
File descriptor to write log entries to.
Action entry() override
Arrival of new log message.
StateFlowSelectHelper selectHelper_
Helper object for asynchronpus writing.
LogEntry * input()
Helper function to get typed current message.
Implementation of the logging proxy that outputs all logs to a serial port.
SerialLoggingServer(Service *service, const char *name)
Constructor.
Collection of related state machines that pend on incoming messages.
Return type for a state flow callback.
Service * service()
Return a pointer to the service I am bound to.
Action write_repeated(StateFlowSelectHelper *helper, int fd, const void *buf, size_t size, Callback c, unsigned priority=Selectable::MAX_PRIO)
Writes some data into a file descriptor, repeating the operation as necessary until all bytes are wri...
Action release_and_exit()
Terminates the processing of the current message.
State flow with a given typed input queue.
Implementation of the logging proxy that listens on a TCP port, waits for the first incoming connecti...
void on_new_connection(int fd)
Callback for the TCP server.
SocketListener listener_
Helper class for listening on a TCP socket.
TcpLoggingServer(Service *service, int port)
Constructor.
#define HASSERT(x)
Checks that the value of expression x is true, else terminates the current process.
Buffer content structure for sending log entries.
string data
Log output line. Contains a trailing newline.
Use this class to read from an fd using select() in a state flow.
unsigned hasError_
1 if there was an error reading of writing.