| 1 | <?php |
||
| 17 | class FluentdTarget extends \yii\log\Target |
||
| 18 | { |
||
| 19 | |||
| 20 | /** |
||
| 21 | * @var string Fluentd host |
||
| 22 | */ |
||
| 23 | public $host = 'localhost'; |
||
| 24 | /** |
||
| 25 | * @var int Fluentd port |
||
| 26 | */ |
||
| 27 | public $port = 24224; |
||
| 28 | /** |
||
| 29 | * @var array Options for Fluentd client |
||
| 30 | */ |
||
| 31 | public $options = []; |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @var string Tag format, available placeholders: %date, %timestamp, %level |
||
| 35 | */ |
||
| 36 | public $tagFormat = 'app.%level'; |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @var FluentLogger Fluentd client instance |
||
| 40 | */ |
||
| 41 | private $_logger; |
||
| 42 | |||
| 43 | |||
| 44 | /** |
||
| 45 | * @inheritdoc |
||
| 46 | */ |
||
| 47 | public function init() |
||
| 53 | |||
| 54 | /** |
||
| 55 | * @inheritdoc |
||
| 56 | */ |
||
| 57 | public function export() |
||
| 63 | |||
| 64 | |||
| 65 | /** |
||
| 66 | * Generating tag name based on $tagFormat |
||
| 67 | * |
||
| 68 | * @param $messages |
||
| 69 | * @return string |
||
| 70 | */ |
||
| 71 | private function createTag($messages) |
||
| 77 | } |