Trading API for C
7.0.0.309536
|
Typedefs | |
typedef void(* | ctl_log_cb) (void *ctx, ctl_loglevel level, const char *fmt, va_list ap) |
Callback type for logging. More... | |
Enumerations |
Functions | |
char * | ctl_channel_tostring (ctl_channel *channel, char *buf, size_t buflen) |
Create a string representation of a ctl_channel object. More... | |
const char * | ctl_error_tostring (ctl_error error) |
Return a textual description for the given error code. More... | |
void | ctl_log (ctl_provider *provider, ctl_loglevel level, const char *fmt,...) |
Log a message to the logfile for the provider. More... | |
const char * | ctl_loglevel_tostring (ctl_loglevel level) |
Return a textual description for the given log level. More... | |
void | ctl_set_log_callback (ctl_provider *provider, ctl_log_cb callback, void *ctx) |
Set the log callback function. More... | |
char * | ctl_trade_tostring (ctl_trade *trade, char *buf, size_t buflen) |
Create a string representation of a ctl_trade object. More... | |
char * | ctl_tradeevent_tostring (ctl_tradeevent *ev, char *buf, size_t buflen) |
Create a string representation of a ctl_tradeevent object. More... | |
typedef void(* ctl_log_cb) (void *ctx, ctl_loglevel level, const char *fmt, va_list ap) |
Callback type for logging.
ctx | - Your specified callback context |
level | - The level that this log message should be logged at |
fmt | - A standard printf style format string |
ap | - Variadic arguments |
If you wish to override the default logging of the Trading API, you can call ctl_set_log_callback() and specify your own callback and associated context.
enum ctl_loglevel |
Enumeration that represents the available logging levels.
See ctl_loglevel_tostring() which returns a textual description of the logging level.
char* ctl_channel_tostring | ( | ctl_channel * | channel, |
char * | buf, | ||
size_t | buflen | ||
) |
Create a string representation of a ctl_channel object.
channel | - The channel to create a string represenation of |
buf | - Buffer to serialise into |
buflen | - Size of the buffer |
A buffer size that would capture all the required information would be in the region of 100 bytes (depending on the length of the username).
const char* ctl_error_tostring | ( | ctl_error | error | ) |
Return a textual description for the given error code.
error | - Error code |
void ctl_log | ( | ctl_provider * | provider, |
ctl_loglevel | level, | ||
const char * | fmt, | ||
... | |||
) |
Log a message to the logfile for the provider.
provider | - The provider to log for |
level | - The log level |
fmt | - Printf style argument |
const char* ctl_loglevel_tostring | ( | ctl_loglevel | level | ) |
Return a textual description for the given log level.
level | - Log level |
void ctl_set_log_callback | ( | ctl_provider * | provider, |
ctl_log_cb | callback, | ||
void * | ctx | ||
) |
Set the log callback function.
provider | - The provider to register the callback for |
callback | - Callback function |
ctx | - Callback context |
The callback function will be invoked for each log message that should be logged.
If provider is NULL, then the default log callback will be set for the whole library.
char* ctl_trade_tostring | ( | ctl_trade * | trade, |
char * | buf, | ||
size_t | buflen | ||
) |
Create a string representation of a ctl_trade object.
trade | - The trade to create a string represenation of |
buf | - Buffer to serialise into |
buflen | - Size of the buffer |
A buffer size that would capture all the required information would be in the region of 100 bytes
char* ctl_tradeevent_tostring | ( | ctl_tradeevent * | ev, |
char * | buf, | ||
size_t | buflen | ||
) |
Create a string representation of a ctl_tradeevent object.
ev | - The tradevent to create a string represenation of |
buf | - Buffer to serialise into |
buflen | - Size of the buffer |
The length of the required buffer (to obtain a non-truncated represensation) depends on the number (and length) of the fields within the trade event.