xbee_err xbee_logLevelGet(struct xbee *xbee, int *level);
xbee_err xbee_logLevelSet(struct xbee *xbee, int level);
xbee_err xbee_logTargetGet(struct xbee *xbee, FILE **f);
xbee_err xbee_logTargetSet(struct xbee *xbee, FILE *f);
xbee_err xbee_logRxGet(struct xbee *xbee, int *enable);
xbee_err xbee_logRxSet(struct xbee *xbee, int enabled);
xbee_err xbee_logTxGet(struct xbee *xbee, int *enable);
xbee_err xbee_logTxSet(struct xbee *xbee, int enabled);
xbee_err xbee_logColorGet(struct xbee *xbee, int *enable);
xbee_err xbee_logColorSet(struct xbee *xbee, int enabled);
The level may be any number, and indicates the verbosity of log messages. A higher number will generate a more verbose output. See xbee_log(3) for more details on how this affects log output.
You may redirect the log output using xbee_logTargetSet(). f must be an open file descriptor that will allow writing. By default, libxbee will log to stderr.
You may enable and disable various logging components using xbee_logRxSet() and xbee_logTxSet(). enable is handled as a boolean value, and will enable or disable logging of either Rx data or Tx payload data respectively.
You may also enable or disable colorized logging using xbee_logColorSet(). enable is handled as a boolean value, and will enable or disable the output of ANSI color escape sequences. Colorized output only works for TTY devices, not files. if you use xbee_logTargetSet() to log to a file, then the output will not contain ANSI color escape sequences.
These settings may be configured at runtime using the following environment variables:
XBEE_LOG_LEVEL XBEE_LOG_RX XBEE_LOG_TX XBEE_LOG_COLOR
#include <xbee.h> struct xbee *xbee; FILE *log; /* initialize xbee, using xbee_setup() */ if ((log = fopen("libxbee.log", "w")) == NULL) return; if (xbee_logTargetSet(xbee, log) != XBEE_ENONE) return; if (xbee_logLevelSet(xbee, 100) != XBEE_ENONE) return;