ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
Monolog\Formatter\ElasticaFormatter Class Reference

Format a log message into an Elastica Document. More...

+ Inheritance diagram for Monolog\Formatter\ElasticaFormatter:
+ Collaboration diagram for Monolog\Formatter\ElasticaFormatter:

Public Member Functions

 __construct ($index, $type)
 
 format (array $record)
 {Formats a log record.
Parameters
array$recordA record to format
Returns
mixed The formatted record
} More...
 
 getIndex ()
 Getter index. More...
 
 getType ()
 Getter type. More...
 
- Public Member Functions inherited from Monolog\Formatter\NormalizerFormatter
 __construct ($dateFormat=null)
 
 format (array $record)
 {Formats a log record.
Parameters
array$recordA record to format
Returns
mixed The formatted record
} More...
 
 formatBatch (array $records)
 {Formats a set of log records.
Parameters
array$recordsA set of records to format
Returns
mixed The formatted set of records
} More...
 

Protected Member Functions

 getDocument ($record)
 Convert a log message into an Elastica Document. More...
 
- Protected Member Functions inherited from Monolog\Formatter\NormalizerFormatter
 normalize ($data)
 
 normalizeException (Exception $e)
 
 toJson ($data, $ignoreErrors=false)
 

Protected Attributes

 $index
 
 $type
 
- Protected Attributes inherited from Monolog\Formatter\NormalizerFormatter
 $dateFormat
 

Additional Inherited Members

- Data Fields inherited from Monolog\Formatter\NormalizerFormatter
const SIMPLE_DATE = "Y-m-d H:i:s"
 

Detailed Description

Format a log message into an Elastica Document.

Author
Jelle Vink jelle.nosp@m..vin.nosp@m.k@gma.nosp@m.il.c.nosp@m.om

Definition at line 21 of file ElasticaFormatter.php.

Constructor & Destructor Documentation

◆ __construct()

Monolog\Formatter\ElasticaFormatter::__construct (   $index,
  $type 
)
Parameters
string$indexElastic Search index name
string$typeElastic Search document type

Definition at line 37 of file ElasticaFormatter.php.

References Monolog\Formatter\ElasticaFormatter\$index, and Monolog\Formatter\ElasticaFormatter\$type.

38  {
39  parent::__construct(\DateTime::ISO8601);
40  $this->index = $index;
41  $this->type = $type;
42  }

Member Function Documentation

◆ format()

Monolog\Formatter\ElasticaFormatter::format ( array  $record)

{Formats a log record.

Parameters
array$recordA record to format
Returns
mixed The formatted record
}

Implements Monolog\Formatter\FormatterInterface.

Definition at line 47 of file ElasticaFormatter.php.

References Monolog\Formatter\ElasticaFormatter\getDocument().

48  {
49  $record = parent::format($record);
50 
51  return $this->getDocument($record);
52  }
getDocument($record)
Convert a log message into an Elastica Document.
+ Here is the call graph for this function:

◆ getDocument()

Monolog\Formatter\ElasticaFormatter::getDocument (   $record)
protected

Convert a log message into an Elastica Document.

Parameters
array$recordLog message
Returns
Document

Definition at line 78 of file ElasticaFormatter.php.

Referenced by Monolog\Formatter\ElasticaFormatter\format().

79  {
80  $document = new Document();
81  $document->setData($record);
82  $document->setType($this->type);
83  $document->setIndex($this->index);
84 
85  return $document;
86  }
+ Here is the caller graph for this function:

◆ getIndex()

Monolog\Formatter\ElasticaFormatter::getIndex ( )

Getter index.

Returns
string

Definition at line 58 of file ElasticaFormatter.php.

References Monolog\Formatter\ElasticaFormatter\$index.

◆ getType()

Monolog\Formatter\ElasticaFormatter::getType ( )

Getter type.

Returns
string

Definition at line 67 of file ElasticaFormatter.php.

References Monolog\Formatter\ElasticaFormatter\$type.

Field Documentation

◆ $index

Monolog\Formatter\ElasticaFormatter::$index
protected

◆ $type

Monolog\Formatter\ElasticaFormatter::$type
protected

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