-
Notifications
You must be signed in to change notification settings - Fork 95
Description
A single unified function is needed for logging error handling. It should perform several tasks:
-
Use one unified error logging function instead of
r.error
calls throughout the code. This ensures a consistent log format. -
Format messages in the nginx log style, with additional request information such as
host
,client IP
,request uri
at the end. This will help quickly understand the conditions under which the error occurred. -
Assign each error its own identifier, which should have some relation to the
request_id
var (for example, the first 8 chars of request_id), so that error log entries can be correlated. -
Optionally: support structured logs (e.g., as JSON). Also be able to return an error message to the User Agent in plain text depending on the settings/context.
-
When
debug
mode is enabled (via var), log the full stack trace of the error to simplify diagnostics, and in normal mode, log a shorter error message.