martenframework / marten

The pragmatic web framework.
https://martenframework.com
MIT License
425 stars 24 forks source link

Add a new --log-level option for management commands #248

Closed ellmetha closed 3 months ago

ellmetha commented 4 months ago

Description

Context

Right now Marten provides a log_level setting that allows to configure the log level to use when running a project server. One of the limitations we have presently is that setting this log level to debug will also impact management commands and this may not be desirable. Indeed, while it may be necessary to enable debug logs for the development server, this does not necessarily mean that this log level should also be used when running management commands such as migrate or listmigrations since this can pollute the output of such commands.

Proposition

Let's introduce a new --log-level option that will be shared by all the available management commands (similarly to other options such as --error-trace). The log level associated with this option should default to info unless set explicitly.

For example:

$ marten migrate --log-level=debug

We should also clarify the fact that the log_level setting applies mainly to the Marten server and that it does not impact management commands (for which it is possible to set the log level by using the --log-level option).