PHP code example of digitaldev-lx / log-hole

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

    

digitaldev-lx / log-hole example snippets


LOG_CHANNEL=database

'channels' => [
    /*.... */
    'database' => config('log-hole.database'),
],

use DigitalDevLx\LogHole\Middlewares\LogHoleMiddleware;

protected $middlewareGroups = [
    'web' => [
        // outros middlewares
        \DigitalDevLx\LogHole\Middleware\LogHoleMiddleware::class,
    ],
];

use DigitalDevLx\LogHole\Middlewares\LogHoleMiddleware;
 
->withMiddleware(function (Middleware $middleware) {
     $middleware->append(LogHoleMiddleware::class);
})

use DigitalDevLx\LogHole\Attributes\Loggable;

class ExampleService
{
    #[Loggable(message: 'Executed important method', level: 'info')]
    public function importantMethod()
    {
        // Lógica 
    }
}

use Illuminate\Support\Facades\Log;

Log::info('This is a log message for LogHole!');
Log::error('An error occurred in LogHole');
bash
php artisan vendor:publish --provider="DigitalDevLx\LogHole\LogHoleServiceProvider" --tag=logs-config
bash
php artisan log-hole:tail --error --from=2024-10-01 --to=2024-10-31