PHP code example of elveneek / log

1. Go to this page and download the library: Download elveneek/log 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/ */

    

elveneek / log example snippets


Elveneek\Log::get()->debug('Debug message',['user'=>'username', 'order_id'=> 12]);
Elveneek\Log::debug('test',['user'=>'username', 'order_id'=> 12]);
Elveneek\RotatingLog::info('test',['user'=>'username2', 'order_id'=> 12]);

//Размещение разных логов в зависимости от контекста или даты

class OrderLog extends \Elveneek\Log 
{
	 public function customFilename($record){
	 
		return $record["context"]['order_id'] .  '.log';
    }
	
}


OrderLog::info('Order created', ['order_id'=> $order->id, 'data'=>$import_data]);