0

I'm using the librdkafka c++ API and I would like to change the default behavior of the logger.

In the c API there is this function rd_kafka_conf_set_log_cb() to set the log callback. It takes a function with the signature:

void(*)(const rd_kafka_t *rk, int level, const char *fac, const char *buf)

However I can't figure out what const char *fac does in the function signature. I can see that strings such as "FAIL" or "BGQUEUE" are passed when using it, but I can't find any documentation on what they mean or how to use them.

What is the const char *fac used for, and are there docs on its use or a dictionary for their definitions?

Ihor Konovalenko
  • 1,298
  • 2
  • 16
  • 21

1 Answers1

0

The facility string is a semi-unique name for the context where the log is emitted. It is mainly there to help librdkafka maintainers identify the source of a log line, but can also be used for filtering purposes.

It was originally inspired by Cisco IOS like system logs which came in the form of:

FAC-LVL-SUBFAC: Message...

The librdkafka counterpart would be:

RDKAFKA-7-JOIN: Joining consumer group xyx

where JOIN is the librdkafka logging facility.

Edenhill
  • 2,897
  • 22
  • 35