PHP code example of rusadrako / log

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

    

rusadrako / log example snippets




use RusaDrako\log\log;
// Полный путь к файлу логирования
$file = __DIR__ . '/test.log';
// Активируем объект логирования
$objLog = new log($file, log::SEPARATION_HOUR);
// Добавляем запись без даты
$objLog->addLog('test', 0);
// Добавляем запись с датой
$objLog->addLog('test with date');
// Выводим реальное имя файла лога
echo $objLog->getFile();
// Выводим последние 20 строк файла лога
var_dump($objLog->getLastRows(20));