PHP code example of tolawho / loggy

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

    

tolawho / loggy example snippets


'providers' => [
    ...
    Tolawho\Loggy\ServiceProvider::class,
],

'aliases' => [
    ... 
    'Loggy' => Tolawho\Loggy\Facades\Loggy::class,
],

php artisan vendor:publish --provider="Tolawho\Loggy\ServiceProvider"


    
    return [
        'channels' => [
            'event' => [
                'log' => 'event.log',
                'daily' => false,
                'level' => 'debug'
            ],
            'payment' => [
                'log' => 'payment.log',
                'daily' => true,
                'level' => 'info'
            ],
        ]
    ];



 
namespace App\Http\Controllers;
 
use Loggy; 
 
class HomeController extends Controller
{

    public function index()
    {
        Loggy::write('event', 'Ah hihi đồ ngốc');
        Loggy::debug('event', 'Ah hihi đồ ngốc');
        Loggy::info('event', 'Ah hihi đồ ngốc');
        
        return view('welcome');
    }
}

Tolawho\Loggy\ServiceProvider::class,

'Loggy' => Tolawho\Loggy\Facades\Loggy::class

php artisan vendor:publish --provider="Tolawho\Loggy\ServiceProvider"

Loggy::write('payment', 'Somthing 1...', ['something 1']);
Loggy::info('payment', 'Somthing 2..', ['something 2']);