RdKafka\Conf::setLogCb

(PECL rdkafka >= 4.0.0, librdkafka >= 0.9.4)

RdKafka\Conf::setLogCbSet log callback

Description

public RdKafka\Conf::setLogCb ( callable $callback ) : void

Set log callback. You will get events according to log_level that was set in RdKafka\Conf

Note:

HINT: The extension takes care of setting log.queue to true in RdKafka\Conf which is needed for this.

Parameters

callback (callable)

A callable with the following signature:

<?php
/**
 * @param object $kafka
 * @param int $level
 * @param string $facility
 * @param string $message
 */
function ($kafka$level$facility$message);

Return Values

Returns no value.

Examples

Example #1 RdKafka\Conf::setLogCb() example

<?php
$conf
->setLogCb(function ($kafka$level$facility$message) {
    
printf("Kafka %s: %s (level: %d)\n"$facility$message$level);
});
?>