MediaWiki REL1_33
|
Log handler sends log events to a kafka server. More...
Public Member Functions | |
__construct (Produce $produce, array $options, $level=Logger::DEBUG, $bubble=true) | |
handleBatch (array $batch) | |
@inheritDoc | |
Static Public Member Functions | |
static | factory ( $kafkaServers, array $options=[], $level=Logger::DEBUG, $bubble=true) |
Constructs the necessary support objects and returns a KafkaHandler instance. | |
Protected Member Functions | |
addMessages ( $channel, array $records) | |
Adds records for a channel to the Kafka client internal queue. | |
getRandomPartition ( $topic) | |
send () | |
Send any records in the kafka client internal queue. | |
warning ( $message, array $context=[]) | |
write (array $record) | |
@inheritDoc | |
Protected Attributes | |
array | $options |
Optional handler configuration. | |
array | $partitions = [] |
Map from topic name to partition this request produces to. | |
Produce | $produce |
Sends requests to kafka. | |
Static Private Attributes | |
static array | $defaultOptions |
defaults for constructor options | |
Log handler sends log events to a kafka server.
Constructor options array arguments:
Requires the nmred/kafka-php library, version >= 1.3.0
Definition at line 49 of file KafkaHandler.php.
MediaWiki\Logger\Monolog\KafkaHandler::__construct | ( | Produce | $produce, |
array | $options, | ||
$level = Logger::DEBUG, | |||
$bubble = true ) |
Produce | $produce | Kafka instance to produce through |
array | $options | optional handler configuration |
int | $level | The minimum logging level at which this handler will be triggered |
bool | $bubble | Whether the messages that are handled can bubble up the stack or not |
Definition at line 81 of file KafkaHandler.php.
References MediaWiki\Logger\Monolog\KafkaHandler\$options, MediaWiki\Logger\Monolog\KafkaHandler\$produce, and(), and options().
|
protected |
Adds records for a channel to the Kafka client internal queue.
string | $channel | Name of Monolog channel records belong to |
array | $records | List of records to append |
Definition at line 256 of file KafkaHandler.php.
References MediaWiki\Logger\Monolog\KafkaHandler\getRandomPartition(), and options().
Referenced by MediaWiki\Logger\Monolog\KafkaHandler\handleBatch(), and MediaWiki\Logger\Monolog\KafkaHandler\write().
|
static |
Constructs the necessary support objects and returns a KafkaHandler instance.
string[] | $kafkaServers | |
array | $options | |
int | $level | The minimum logging level at which this handle will be triggered |
bool | $bubble | Whether the messages that are handled can bubble the stack or not |
Definition at line 99 of file KafkaHandler.php.
References MediaWiki\Logger\Monolog\KafkaHandler\$options, MediaWiki\Logger\Monolog\KafkaHandler\$produce, and(), and MediaWiki\Logger\LoggerFactory\getInstance().
|
protected |
string | $topic | Name of topic to get partition for |
Definition at line 219 of file KafkaHandler.php.
References $e, MediaWiki\Logger\Monolog\KafkaHandler\$partitions, and(), and MediaWiki\Logger\Monolog\KafkaHandler\warning().
Referenced by MediaWiki\Logger\Monolog\KafkaHandler\addMessages().
MediaWiki\Logger\Monolog\KafkaHandler::handleBatch | ( | array | $batch | ) |
@inheritDoc
Definition at line 143 of file KafkaHandler.php.
References $batch, $messages, MediaWiki\Logger\Monolog\KafkaHandler\addMessages(), and(), and MediaWiki\Logger\Monolog\KafkaHandler\send().
|
protected |
Send any records in the kafka client internal queue.
Definition at line 172 of file KafkaHandler.php.
References $e, $response, and(), and MediaWiki\Logger\Monolog\KafkaHandler\warning().
Referenced by MediaWiki\Logger\Monolog\KafkaHandler\handleBatch(), and MediaWiki\Logger\Monolog\KafkaHandler\write().
|
protected |
string | $message | PSR3 compatible message string |
array | $context | PSR3 compatible log context |
Definition at line 269 of file KafkaHandler.php.
References $context, and options().
Referenced by MediaWiki\Logger\Monolog\KafkaHandler\getRandomPartition(), and MediaWiki\Logger\Monolog\KafkaHandler\send().
|
protected |
@inheritDoc
Definition at line 133 of file KafkaHandler.php.
References MediaWiki\Logger\Monolog\KafkaHandler\addMessages(), and MediaWiki\Logger\Monolog\KafkaHandler\send().
|
staticprivate |
defaults for constructor options
Definition at line 68 of file KafkaHandler.php.
|
protected |
Optional handler configuration.
Definition at line 58 of file KafkaHandler.php.
Referenced by MediaWiki\Logger\Monolog\KafkaHandler\__construct(), and MediaWiki\Logger\Monolog\KafkaHandler\factory().
|
protected |
Map from topic name to partition this request produces to.
Definition at line 63 of file KafkaHandler.php.
Referenced by MediaWiki\Logger\Monolog\KafkaHandler\getRandomPartition().
|
protected |
Sends requests to kafka.
Definition at line 53 of file KafkaHandler.php.
Referenced by MediaWiki\Logger\Monolog\KafkaHandler\__construct(), and MediaWiki\Logger\Monolog\KafkaHandler\factory().