MediaWiki  1.27.2
MediaWiki\Logger\Monolog\AvroFormatter Class Reference

Log message formatter that uses the apache Avro format. More...

Inheritance diagram for MediaWiki\Logger\Monolog\AvroFormatter:
Collaboration diagram for MediaWiki\Logger\Monolog\AvroFormatter:

Public Member Functions

 __construct (array $schemas)
 
 format (array $record)
 Formats the record context into a binary string per the schema configured for the records channel. More...
 
 formatBatch (array $records)
 Format a set of records into a list of binary strings conforming to the configured schema. More...
 
 getSchemaRevisionId ($channel)
 

Protected Member Functions

 getSchema ($channel)
 

Protected Attributes

AvroIOBinaryEncoder $encoder
 
AvroStringIO $io
 
array $schemas
 Map from schema name to schema definition. More...
 
AvroIODatumWriter $writer
 

Private Member Functions

 encodeLong ($id)
 convert an integer to a 64bits big endian long (Java compatible) NOTE: certainly only compatible with PHP 64bits More...
 

Detailed Description

Log message formatter that uses the apache Avro format.

Since
1.26
Author
Erik Bernhardson ebern.nosp@m.hard.nosp@m.son@w.nosp@m.ikim.nosp@m.edia..nosp@m.org
Note
© 2015 Erik Bernhardson and Wikimedia Foundation.

Definition at line 39 of file AvroFormatter.php.

Constructor & Destructor Documentation

MediaWiki\Logger\Monolog\AvroFormatter::__construct ( array  $schemas)

Definition at line 69 of file AvroFormatter.php.

References MediaWiki\Logger\Monolog\AvroFormatter\$schemas, and writer.

Member Function Documentation

MediaWiki\Logger\Monolog\AvroFormatter::encodeLong (   $id)
private

convert an integer to a 64bits big endian long (Java compatible) NOTE: certainly only compatible with PHP 64bits

Parameters
int$id
Returns
string the binary representation of $id

Definition at line 169 of file AvroFormatter.php.

Referenced by MediaWiki\Logger\Monolog\AvroFormatter\format().

MediaWiki\Logger\Monolog\AvroFormatter::format ( array  $record)

Formats the record context into a binary string per the schema configured for the records channel.

Parameters
array$record
Returns
string|null The serialized record, or null if the record is not valid for the selected schema.

Definition at line 84 of file AvroFormatter.php.

References $e, $revId, MediaWiki\Logger\Monolog\AvroFormatter\encodeLong(), AvroValidator\getErrors(), MediaWiki\Logger\Monolog\AvroFormatter\getSchema(), MediaWiki\Logger\Monolog\AvroFormatter\getSchemaRevisionId(), and writer.

Referenced by MediaWiki\Logger\Monolog\AvroFormatter\formatBatch().

MediaWiki\Logger\Monolog\AvroFormatter::formatBatch ( array  $records)

Format a set of records into a list of binary strings conforming to the configured schema.

Parameters
array$records
Returns
string[]

Definition at line 110 of file AvroFormatter.php.

References as, and MediaWiki\Logger\Monolog\AvroFormatter\format().

MediaWiki\Logger\Monolog\AvroFormatter::getSchema (   $channel)
protected

Definition at line 127 of file AvroFormatter.php.

Referenced by MediaWiki\Logger\Monolog\AvroFormatter\format().

MediaWiki\Logger\Monolog\AvroFormatter::getSchemaRevisionId (   $channel)

Definition at line 156 of file AvroFormatter.php.

Referenced by MediaWiki\Logger\Monolog\AvroFormatter\format().

Member Data Documentation

AvroIOBinaryEncoder MediaWiki\Logger\Monolog\AvroFormatter::$encoder
protected

Definition at line 57 of file AvroFormatter.php.

AvroStringIO MediaWiki\Logger\Monolog\AvroFormatter::$io
protected

Definition at line 52 of file AvroFormatter.php.

array MediaWiki\Logger\Monolog\AvroFormatter::$schemas
protected
Initial value:
=
const MAGIC 0x0

Map from schema name to schema definition.

Definition at line 40 of file AvroFormatter.php.

Referenced by MediaWiki\Logger\Monolog\AvroFormatter\__construct().

AvroIODatumWriter MediaWiki\Logger\Monolog\AvroFormatter::$writer
protected

Definition at line 62 of file AvroFormatter.php.


The documentation for this class was generated from the following file: