PHP code example of igancev / log
1. Go to this page and download the library: Download igancev/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/ */
igancev / log example snippets
(new Igancev\Log\Log('log text'))->setFileDir('/log/path/')->setLifeTime(5)->addLog();
use Igancev\Log\Log;
$log = new Log;
// пример всех настроек
$log
->setFileDir('/my/auto/creating/dir/')
->setFileName('myFileName')
->setFileExt('txt')
->setSort(Log::SORT_DESC)
->setLifeTime(10)
->addText("my log text\n");
// добавление текста к логу по мере надобности
$log->addText("add more text");
// запись лога в файл
$log->addLog();
use Igancev\Log\LogGarbageCollector;
LogGarbageCollector::clearOld('/path/to/clear/dir', true);