Skip to content
Sébastien Dawans edited this page Oct 23, 2013 · 10 revisions

LOG6LBR_ Macros

6LBR uses its own logging system, different than the one used in Contiki. It is compatible with log4cxx.

Throughout the 6LBR source code, macros are used to log information to the 6LBR log files:

  LOG6LBR_FATAL()
  LOG6LBR_ERROR()
  LOG6LBR_WARN()
  LOG6LBR_INFO() 
  LOG6LBR_DEBUG()
  LOG6LBR_PACKET()
  LOG6LBR_DUMP()
  LOG6LBR_TRACE()

As opposed to the Contiki PRINTF macros, 6LBR’s log system is less optimized for code size than it is for modularity at runtime. By default, all logging information implemented with the above LOG6LBR_ macros are compiled into the 6LBR binary, but their activation is determined at runtime through two parameters passed to 6LBR:

  • LOG_LEVEL: is the level of verbosity.

The macros are organized in a hiarchical manner, and the LOG_LEVEL value (multiplied by 10) determines upto which level the macros are activated, the least verbose mode being 0:

  Log6lbr_Level_FATAL = 0,
  Log6lbr_Level_ERROR = 10,
  Log6lbr_Level_WARN = 20,
  Log6lbr_Level_INFO = 30,
  Log6lbr_Level_DEBUG = 40,
  Log6lbr_Level_PACKET = 50,
  Log6lbr_Level_DUMP = 60,
  Log6lbr_Level_TRACE = 70

The maximum value is 127, which garantees full verbosity even if more levels are added.
The default value is 30, which is enough information for a production 6LBR. In that mode, most of the useful logging information of the initilization phase is preserved, and the logging goes relatively silent once the system is running and no errors occur.

  Log6lbr_Level_ALL = 127,
  Log6lbr_Level_DEFAULT = Log6lbr_Level_INFO
  • LOG_SERVICES: is a bitmask specifying which modules should activate logging. The different modules and their respective values in the bitmask are (copied directly from the enum in the source code):
  Log6lbr_Service_GLOBAL    = 0x00000001,
  Log6lbr_Service_ETH_IN    = 0x00000002,
  Log6lbr_Service_ETH_OUT   = 0x00000004,
  Log6lbr_Service_RADIO_IN  = 0x00000008,
  Log6lbr_Service_RADIO_OUT = 0x00000010,
  Log6lbr_Service_TAP_IN    = 0x00000012,
  Log6lbr_Service_TAP_OUT   = 0x00000014,
  Log6lbr_Service_SLIP_IN   = 0x00000018,
  Log6lbr_Service_SLIP_OUT  = 0x00000020,
  Log6lbr_Service_PF_IN     = 0x00000022,
  Log6lbr_Service_PF_OUT    = 0x00000024,
  Log6lbr_Service_SLIP_DBG  = 0x00000028

All the services are logged with 0xFFFFFFFF (-1), which is also the default value:

  Log6lbr_Service_ALL = -1,
  Log6lbr_Service_DEFAULT = Log6lbr_Service_ALL

Other printing macros

More information

For more details, please refer to:

Clone this wiki locally