pazakharov/yii2-log-loki-target

Loki log target

0.0.5 2023-01-10 10:53 UTC

This package is auto-updated.

Last update: 2024-04-10 13:35:46 UTC


README

Yii2 log target for loki

Setup

install via composer

composer require pazakharov/yii2-log-loki-target

add the log as target:

 'targets' => [
                'loki' => [
                    'class' => \pazakharov\yii2\LokiTarget::class,
                    'levels' => ['warning'],
                    'label' => 'loki',
                    'lokiUrl' => '/api/v1/push',
                    'client' => [
                        'class' => \yii\httpclient\Client::class,
                        'baseUrl' => env('LOKI_HOST')
                    ],
                ],
            ],

You can define property 'formatMessageCallback' - callable that format message before sending it to the loki server