PHP code example of lswl / laravel-log

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

    

lswl / laravel-log example snippets


use Lswl\Log\Log;

// 添加各个级别日志
// emergency、alert、 critical、 error、 warning、 notice、 info 和 debug
Log::info('This is info log');

// 添加指定路径
// app/storage/logs/d/laravel.log
Log::dir('d')
->info('This is info log');
// app/storage/logs/20200101/d/laravel.log
Log::dir('d')
->withDateToDir()
->info('This is info log');

// 添加指定名称路径
// app/storage/logs/d/i.log
Log::dir('d')
->name('i')
->info('This is info log');
// app/storage/logs/d/20200101-i.log
Log::dir('d')
->name('i')
->withDateToName()
->info('This is info log');