Logging
Logging records diagnostic events with useful context.
What it is
Logging records diagnostic events with useful context.
When to use it
Record failures and identifiers without sensitive payloads.
Syntax
Log::info("Order created", ["order_id" => $order->id]);Example
use Illuminate\Support\Facades\Log;
Log::warning("Settlement delayed", [
"transaction_id" => $transaction->id,
"correlation_id" => $requestId,
"reason_code" => "provider_timeout",
]);Common mistakes
Do not log passwords, tokens, full bank details, or raw request bodies.