logClient.h

Client on the IOC that forwards log messages to the log server.

Together with the program iocLogServer, a log client provides generic support for logging text messages from an IOC or other program to the log server host machine.

Typedefs

typedef void *logClientId

Abstract type that represents handle to the log client.

Functions

logClientId logClientCreate(struct in_addr server_addr, unsigned short server_port)

Creates a new log client.

Starts a background thread to connect to server and returns immediately. If a connection cannot be established, an error message is printed on the console, but the log client will keep trying to connect in the background. This thread will also periodically (every 5 seconds) flush pending messages out to the server.

Parameters:
  • server_addr – log server IP address

  • server_port – log server port

Returns:

log client handle.

void logClientSend(logClientId id, const char *message)

Log message.

Logs message to log server. Messages are not immediately sent to the log server. Instead they are sent periodically (every 5 seconds), when the cache overflows, or when logClientFlush() is called. If messages can’t sent, an error message will be printed to stderr

Parameters:
  • id – log client handle

  • message – log message

void logClientShow(logClientId id, unsigned level)

Prints debug information about the log client state.

Print information about the log client’s internal state such as, connection status and cache state, to stdout

Parameters:
  • id – log client handle

  • level – verbosity level. Level range is from 0 to 2

void logClientFlush(logClientId id)

Flushes all outstanding messages.

Immediately sends all outstanding messages to the server

Parameters:

id – log client handle

void iocLogPrefix(const char *prefix)

Set prefix to be sent infront of every log message.

Sets a prefix to prepend every log message. Can only be set once. If already set, this function call will be ignored

Parameters:

prefix – the prefix

logClientId logClientInit(void)

DEPRECATED.

Deprecated:

deprecated interface; retained for backward compatibility