Common debug support

Common debug support — API to activate debugging messages from telepathy-glib

Synopsis


#include <telepathy-glib/debug.h>


void                tp_debug_set_flags_from_string      (const gchar *flags_string);
void                tp_debug_set_flags_from_env         (const gchar *var);
void                tp_debug_set_all_flags              (void);

Description

telepathy-glib has an internal mechanism for debug messages and filtering. Connection managers written with telepathy-glib are expected to connect this to their own debugging mechanisms: when the CM's debugging mechanism is activated, it should call tp_debug_set_flags_from_string(), tp_debug_set_flags_from_env() or tp_debug_set_all_flags().

For example, at the time of writing Gabble has the following behaviour:

  • The environment variable $GABBLE_DEBUG contains a comma-separated list of debug modes to activate. In addition to parsing this variable itself, Gabble calls tp_debug_set_flags_from_env ("GABBLE_DEBUG").
  • The environment variable $GABBLE_PERSIST activates all possible debug modes. If this variable is set, in addition to activating all of its own debug modes, Gabble calls tp_debug_set_all_flags() to activate all possible debug output in telepathy-glib.

The supported debug-mode keywords are subject to change, but currently include:

  • persist - keep running even if there are no connections for a while
  • connection - output debug messages regarding TpBaseConnection
  • im - output debug messages regarding (text) instant messaging
  • properties - output debug messages regarding TpPropertiesMixin
  • params - output debug messages regarding connection manager parameters
  • all - all of the above

Details

tp_debug_set_flags_from_string ()

void                tp_debug_set_flags_from_string      (const gchar *flags_string);

Set the debug flags indicated by flags_string, in addition to any already set.

The parsing matches that of g_parse_debug_string().

flags_string : The flags to set, comma-separated. If NULL or empty, no additional flags are set.

tp_debug_set_flags_from_env ()

void                tp_debug_set_flags_from_env         (const gchar *var);

Set the debug flags indicated by the given environment variable, in addition to any already set. Equivalent to tp_debug_set_flags_from_string (g_getenv (var)).

var : The name of the environment variable to parse

tp_debug_set_all_flags ()

void                tp_debug_set_all_flags              (void);

Activate all possible debug modes.