@extends('layouts.app') @section('content')

Logs with Source Information

@foreach($logs as $log) @endforeach
ID Level Message Source Time
{{ $log->id }} {{ $log->level }} {{ Str::limit($log->message, 100) }} @if(isset($log->source_info)) {{ $log->source_info }} @else No source information @endif {{ $log->created_at->format('Y-m-d H:i:s') }}

How to Use Enhanced Logging

Basic Logging
use Illuminate\Support\Facades\Log;

    Log::debug('This is a debug message');
    Log::info('This is an info message');
    Log::notice('This is a notice message');
    Log::warning('This is a warning message');
    Log::error('This is an error message');
Logging with Additional Context
Log::error('An error occurred', [
        'user_id' => $user->id,
        'action' => 'update_profile',
        'data' => $request->all()
    ]);
Logging Exceptions
try {
        // Some code that might throw an exception
    } catch (\Exception $e) {
        Log::error('An error occurred: ' . $e->getMessage(), [
            'exception' => $e,
            'user_id' => $user->id ?? null
        ]);
    }
Using Helper Methods
use App\Helpers\LogHelper;

    // Get all logs with source information
    $logs = LogHelper::getLogsWithSource();

    // Get error logs with source information
    $errorLogs = LogHelper::getLogsWithSource('error');

    // Get a summary of error sources
    $errorSources = LogHelper::getErrorSourcesSummary();
Note: For more information, see the Enhanced Logging Documentation.
@endsection