From 93a43642e606aa16852666afaef8a3a330f96268 Mon Sep 17 00:00:00 2001 From: Damien MATHIEU Date: Tue, 13 Jan 2026 16:38:07 +0100 Subject: [PATCH] Add skipping database logging with contextual information --- services/error-log.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/services/error-log.md b/services/error-log.md index de622c4e..515949cf 100644 --- a/services/error-log.md +++ b/services/error-log.md @@ -180,6 +180,16 @@ An array of contextual data may also be passed to the log methods. This contextu Log::info('User failed to login.', ['id' => $user->id]); ``` +#### Skipping database logging + +You can set `'skipDatabaseLog' => true` in the context data array to disable database logging. + +```php +Log::info('New user acces.', ['id' => $user->id, 'skipDatabaseLog' => true]); +``` + +> **NOTE**: It is not recommended to skip database logging for important or critical information, as they would then no longer be accessible to administrators authenticated in the backend, but only by reading log files. + ### Helper functions There are some global helper methods available to make logging easier. The `trace_log` function is an alias for `Log::info` with support for using arrays and exceptions as the message.