ThingWorx C SDK
|
Structure definitions and function prototypes for the ThingWorx logging facility. More...
Go to the source code of this file.
Classes | |
struct | twLogger |
ThingWorx Logger singleton structure definition. More... | |
Macros | |
#define | twLogger_H |
Typedefs | |
typedef void(* | log_function) (enum LogLevel level, const char *timestamp, const char *message) |
Signature for logging function to be called when twLog() is invoked. More... | |
typedef struct twLogger | twLogger |
ThingWorx Logger singleton structure definition. | |
Enumerations | |
enum | LogLevel { TW_TRACE, TW_DEBUG, TW_INFO, TW_WARN, TW_ERROR, TW_FORCE, TW_AUDIT } |
Log message level enumeration. More... | |
Functions | |
twLogger * | twLogger_Instance () |
Gets a pointer to the twLogger singleton and creates a new one if it hasn't been created already. More... | |
int | twLogger_Delete () |
Frees all memory associated with the twLogger singleton. More... | |
int | twLogger_SetLevel (enum LogLevel level) |
Sets the ::twLogger#LogLevel of the twLogger singleton. More... | |
int | twLogger_SetFunction (log_function f) |
Sets the ::twLogger#log_function of the twLogger singleton. More... | |
int | twLogger_SetIsVerbose (char val) |
Sets the twLogger::isVerbose flag of the twLogger singleton. More... | |
void | twLog (enum LogLevel level, const char *format,...) |
Logs a message. More... | |
void | twLogHexString (const char *msg, char *preamble, int32_t length) |
Logs a hex string message. More... | |
void | twLogMessage (void *m, char *preamble) |
Logs a generic string message. More... | |
char * | twCodeToString (enum msgCodeEnum m) |
Helper function to convert a msgCodeEnum to a string. More... | |
char * | twEntityToString (enum entityTypeEnum m) |
Helper function to convert a entityTypeEnum to a string. More... | |
char * | twCharacteristicToString (enum characteristicEnum m) |
Helper function to convert a characteristicEnum to a string. More... | |
Structure definitions and function prototypes for the ThingWorx logging facility.
#define twLogger_H |
Prevent multiple inclusions
typedef void(* log_function) (enum LogLevel level, const char *timestamp, const char *message) |
enum LogLevel |
char* twCharacteristicToString | ( | enum characteristicEnum | m | ) |
Helper function to convert a characteristicEnum to a string.
[in] | m | The characteristicEnum to convert. |
m
.char* twCodeToString | ( | enum msgCodeEnum | m | ) |
Helper function to convert a msgCodeEnum to a string.
[in] | m | The msgCodeEnum to convert. |
m
.char* twEntityToString | ( | enum entityTypeEnum | m | ) |
Helper function to convert a entityTypeEnum to a string.
[in] | m | The entityTypeEnum to convert. |
m
.void twLog | ( | enum LogLevel | level, |
const char * | format, | ||
... | |||
) |
Logs a message.
[in] | level | The LogLevel of the message. |
[in] | format | The format of the message. |
[in] | ... | A va_list of messages to log. |
int twLogger_Delete | ( | ) |
Frees all memory associated with the twLogger singleton.
twLogger* twLogger_Instance | ( | ) |
int twLogger_SetFunction | ( | log_function | f | ) |
Sets the ::twLogger#log_function of the twLogger singleton.
[in] | f | The log_function() to use. |
int twLogger_SetIsVerbose | ( | char | val | ) |
Sets the twLogger::isVerbose flag of the twLogger singleton.
[in] | val | TRUE enables verbose logging, FALSE disables verbose logging. |
int twLogger_SetLevel | ( | enum LogLevel | level | ) |
Sets the ::twLogger#LogLevel of the twLogger singleton.
void twLogHexString | ( | const char * | msg, |
char * | preamble, | ||
int32_t | length | ||
) |
Logs a hex string message.
[in] | msg | The message to log. |
[in] | preamble | #TRUE enables message preamble, #FALSE disables message preamble. |
[in] | length | The length of the message. |
void twLogMessage | ( | void * | m, |
char * | preamble | ||
) |
Logs a generic string message.
[in] | m | The message to log. |
[in] | preamble | #TRUE enables message preamble, #FALSE disables message preamble. |