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
return [
'database' => [
'driver' => 'custom',
'via' => DigitalDevLx\LogHole\Channels\DatabaseChannel::class,
'level' => env('LOG_LEVEL', 'debug'),
'table' => 'logs_hole',
],
// Database connection to use for logs (null = default connection)
'connection' => env('LOG_HOLE_DB_CONNECTION', null),
// Emails of users authorized to access the dashboard (empty = open access)
'authorized_users' => [],
// Route prefix for the dashboard
'dashboard_route' => 'log-hole',
// Number of logs per page in the dashboard
'per_page' => 25,
// Auto-refresh the dashboard every 5 seconds
'auto_refresh' => false,
// Cache TTL (in seconds) for the stats() query. 0 disables caching.
// Useful when the dashboard auto-refreshes against a large logs table.
'stats_cache_ttl' => env('LOG_HOLE_STATS_CACHE_TTL', 0),
];
use DigitalDevLx\LogHole\Attributes\Loggable;
class OrderController extends Controller
{
#[Loggable(message: 'Order was created', level: 'info')]
public function store(Request $request)
{
// ... your logic
}
#[Loggable(message: 'Order was deleted', level: 'warning')]
public function destroy(Order $order)
{
// ... your logic
}
}
use DigitalDevLx\LogHole\Attributes\Loggable;
#[Loggable(level: 'info')]
class UserController extends Controller
{
public function index() { /* logged automatically */ }
public function show(User $user) { /* logged automatically */ }
}
use DigitalDevLx\LogHole\Attributes\Loggable;
use DigitalDevLx\LogHole\Enums\LogLevel;
#[Loggable(message: 'Critical action', level: LogLevel::Critical,