ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ElasticaFormatter.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the Monolog package.
5  *
6  * (c) Jordi Boggiano <j.boggiano@seld.be>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11 
12 namespace Monolog\Formatter;
13 
15 
22 {
26  protected $index;
27 
31  protected $type;
32 
37  public function __construct($index, $type)
38  {
39  // elasticsearch requires a ISO 8601 format date with optional millisecond precision.
40  parent::__construct('Y-m-d\TH:i:s.uP');
41 
42  $this->index = $index;
43  $this->type = $type;
44  }
45 
49  public function format(array $record)
50  {
51  $record = parent::format($record);
52 
53  return $this->getDocument($record);
54  }
55 
60  public function getIndex()
61  {
62  return $this->index;
63  }
64 
69  public function getType()
70  {
71  return $this->type;
72  }
73 
80  protected function getDocument($record)
81  {
82  $document = new Document();
83  $document->setData($record);
84  $document->setType($this->type);
85  $document->setIndex($this->index);
86 
87  return $document;
88  }
89 }
format(array $record)
{Formats a log record.A record to format mixed The formatted record}
Normalizes incoming records to remove objects/resources so it&#39;s easier to dump to various targets...
Create styles array
The data for the language used.
Format a log message into an Elastica Document.
Write to Excel2007 format
getDocument($record)
Convert a log message into an Elastica Document.