Let's introduce a revamp of the log entries generated in development environments.
Context
Right now the log entries generated in development environments do not provide much information: they mainly indicate incoming requests (verb, path, request time) and the generated response (and response time). This level of information is suitable for production environment logs, but we could improve this for development environments (where it is often necessary to have access to additional information like SQL queries being executed, routing information, incoming request parameters, etc).
Proposition
New debug log entries format
Unless explicitly set, the log backend used in development should now generate the following entries when processing incoming requests:
Marten running on http://127.0.0.1:8000 (Press CTRL+C to quit)…
Started "GET /path/to/route" at 2024-07-27 15:29:35 UTC…
Data: { "param1" => "value1", "param2" => "value2" }
Query params: { "param1" => "value1", "param2" => "value2" }
Routed to: MyHandler
Executing query: SELECT * FROM users WHERE id = ?
Rendering template: path/to/my_template.html
Rendered template: path/to/my_template.html
Completed with "200" in 63.12ms
The data, query params, routing result, SQL queries, and template rendering lines should only be generated for the debug log level (while the "Started.." and "Completed" ones should be generated for the info log level).
Default log level in development
Unless explicitly set, the development log level should also fall back to the debug one.
Description
Let's introduce a revamp of the log entries generated in development environments.
Context
Right now the log entries generated in development environments do not provide much information: they mainly indicate incoming requests (verb, path, request time) and the generated response (and response time). This level of information is suitable for production environment logs, but we could improve this for development environments (where it is often necessary to have access to additional information like SQL queries being executed, routing information, incoming request parameters, etc).
Proposition
New debug log entries format
Unless explicitly set, the log backend used in development should now generate the following entries when processing incoming requests:
The data, query params, routing result, SQL queries, and template rendering lines should only be generated for the debug log level (while the "Started.." and "Completed" ones should be generated for the info log level).
Default log level in development
Unless explicitly set, the development log level should also fall back to the debug one.