PHP code example of blueant-allan / elasticlogger

1. Go to this page and download the library: Download blueant-allan/elasticlogger library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

blueant-allan / elasticlogger example snippets


public function bootstrap()
{
    // you loaded plugins here

    $this->addPlugin('ElasticLogger');
}

public function initialize(): void
{
    parent::initialize();

    // more of your controller initialize code here


    $this->loadComponent('ElasticLogger.Logcentral');
}

$this->Logcentral->activityInfo('EventType', 'your message');

$this->Logcentral->activityDebug('EventType', 'your message');

$this->Logcentral->activityError('EventType', 'your message');

$this->Logcentral->activityNotice('EventType', 'your message');

$this->Logcentral->activityWarning('EventType', 'your message');

$data = [
    'id' => 42,
    'name' => 'Mark Tune',
    'roles' => ['Admin', 'Support']
];

$this->Logcentral->activityInfo('Login', 'User successfully logged in', $data);