1. Go to this page and download the library: Download understand/understand-lumen 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/ */
understand / understand-lumen example snippets
Dotenv::load(__DIR__.'/../'); // around line 5
...
$app->withFacades(); // around line 22
return [
/**
* Specify which handler to use - sync or async.
*
* Note that the async handler will only work in systems where
* the CURL command line tool is installed
*/
'handler' => env('UNDERSTAND_HANDLER', 'sync'),
/**
* Your input token from Understand.io
*/
'token' => env('UNDERSTAND_INPUT_KEY'),
/**
* Specifies whether logger should throw an exception of issues detected
*/
'silent' => env('UNDERSTAND_SILENT', true),
/**
* Specify additional field providers for each log
* E.g. sha1 version session_id will be appended to each "Log::info('event')"
*/
'meta' => [
'user_id'=> 'Understand\UnderstandLumen\UnderstandFieldProviderFacade::getUserId',
'session_id'=> 'Understand\UnderstandLumen\UnderstandFieldProviderFacade::getSessionId',
'request_id' => 'Understand\UnderstandLumen\UnderstandFieldProviderFacade::getProcessIdentifier',
'url'=> 'Understand\UnderstandLumen\UnderstandFieldProviderFacade::getUrl',
'client_ip'=> 'Understand\UnderstandLumen\UnderstandFieldProviderFacade::getClientIp',
//'server_ip'=> 'Understand\UnderstandLumen\UnderstandFieldProviderFacade::getServerIp',
//'user_agent' => 'Understand\UnderstandLumen\UnderstandFieldProviderFacade::getClientUserAgent',
//'environment' => 'Understand\UnderstandLumen\UnderstandFieldProviderFacade::getEnvironment',
//'request_method'=> 'Understand\UnderstandLumen\UnderstandFieldProviderFacade::getRequestMethod',
],
];
public function report(Exception $e)
{
$encoder = new \UnderstandMonolog\Encoder\ExceptionEncoder();
app('Psr\Log\LoggerInterface')->error($e->getMessage(), $encoder->exceptionToArray($e));
}
$app->get('/', function () use ($app) {
Log::info('test log 123');
return $app->welcome();
});
/**
* Specify additional field providers for each log
* E.g. sha1 version session_id will be appended to each "Log::info('event')"
*/
'meta' => [
'user_id'=> 'Understand\UnderstandLumen\UnderstandFieldProviderFacade::getUserId',
'session_id'=> 'Understand\UnderstandLumen\UnderstandFieldProviderFacade::getSessionId',
'request_id' => 'Understand\UnderstandLumen\UnderstandFieldProviderFacade::getProcessIdentifier',
'url'=> 'Understand\UnderstandLumen\UnderstandFieldProviderFacade::getUrl',
'client_ip'=> 'Understand\UnderstandLumen\UnderstandFieldProviderFacade::getClientIp',
//'server_ip'=> 'Understand\UnderstandLumen\UnderstandFieldProviderFacade::getServerIp',
//'user_agent' => 'Understand\UnderstandLumen\UnderstandFieldProviderFacade::getClientUserAgent',
//'environment' => 'Understand\UnderstandLumen\UnderstandFieldProviderFacade::getEnvironment',
//'request_method'=> 'Understand\UnderstandLumen\UnderstandFieldProviderFacade::getRequestMethod',
],
/**
* Specify which handler to use - sync or async.
*
* Note that the async handler will only work in systems where
* the CURL command line tool is installed
*/
'handler' => 'async',
return [
/**
* Specify which handler to use - sync or async.
*
* Note that the async handler will only work in systems where
* the CURL command line tool is installed
*/
'handler' => env('UNDERSTAND_HANDLER', 'sync'),
/**
* Your input token from Understand.io
*/
'token' => env('UNDERSTAND_INPUT_KEY'),
/**
* Specifies whether logger should throw an exception of issues detected
*/
'silent' => env('UNDERSTAND_SILENT', true),
/**
* Specify additional field providers for each log
* E.g. sha1 version session_id will be appended to each "Log::info('event')"
*/
'meta' => [
'user_id'=> 'Understand\UnderstandLumen\UnderstandFieldProviderFacade::getUserId',
'session_id'=> 'Understand\UnderstandLumen\UnderstandFieldProviderFacade::getSessionId',
'request_id' => 'Understand\UnderstandLumen\UnderstandFieldProviderFacade::getProcessIdentifier',
'url'=> 'Understand\UnderstandLumen\UnderstandFieldProviderFacade::getUrl',
'client_ip'=> 'Understand\UnderstandLumen\UnderstandFieldProviderFacade::getClientIp',
//'server_ip'=> 'Understand\UnderstandLumen\UnderstandFieldProviderFacade::getServerIp',
//'user_agent' => 'Understand\UnderstandLumen\UnderstandFieldProviderFacade::getClientUserAgent',
//'environment' => 'Understand\UnderstandLumen\UnderstandFieldProviderFacade::getEnvironment',
//'request_method'=> 'Understand\UnderstandLumen\UnderstandFieldProviderFacade::getRequestMethod',
],
];
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.