Trading API for C  7.0.0.309536
Logging functionality

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...
 

Detailed Description

Typedef Documentation

typedef void(* ctl_log_cb) (void *ctx, ctl_loglevel level, const char *fmt, va_list ap)

Callback type for logging.

Parameters
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.

Enumeration Type Documentation

Enumeration that represents the available logging levels.

See ctl_loglevel_tostring() which returns a textual description of the logging level.

Enumerator
ctl_LOG_FINEST 

Used for the most finely detailed tracing messages

ctl_LOG_FINER 

Used for fairly detailed tracing messages.

ctl_LOG_DEBUG 

Used for tracing messages

ctl_LOG_INFO 

Used for information messages

ctl_LOG_NOTIFY 

Used for messages of more importance than ctl_loglevel::LOG_INFO but may not indicate problems.

ctl_LOG_WARN 

Used for messages which indicate a potential problem.

ctl_LOG_ERROR 

Used for messages which indicate a problem.

ctl_LOG_CRITICAL 

Used for messages indicating a serious failure.

ctl_LOG_CONFIG 

Used for messages that indicate a problem or feedback with library configuration.

Function Documentation

char* ctl_channel_tostring ( ctl_channel channel,
char *  buf,
size_t  buflen 
)

Create a string representation of a ctl_channel object.

Parameters
channel- The channel to create a string represenation of
buf- Buffer to serialise into
buflen- Size of the buffer
Returns
The supplied buf parameter

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.

Parameters
error- Error code
Returns
A textual description
Note
The memory returned by this function should not be passed free()
void ctl_log ( ctl_provider provider,
ctl_loglevel  level,
const char *  fmt,
  ... 
)

Log a message to the logfile for the provider.

Parameters
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.

Parameters
level- Log level
Returns
A textual description
Note
The memory returned by this function should not be passed free()
void ctl_set_log_callback ( ctl_provider provider,
ctl_log_cb  callback,
void *  ctx 
)

Set the log callback function.

Parameters
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.

Parameters
trade- The trade to create a string represenation of
buf- Buffer to serialise into
buflen- Size of the buffer
Returns
The supplied buf parameter

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.

Parameters
ev- The tradevent to create a string represenation of
buf- Buffer to serialise into
buflen- Size of the buffer
Returns
The supplied buf parameter

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.


Generated on Thu Jun 15 2017 10:22:29 for Trading API for C