Refactor logging configuration to both Django management commands lintmigrations and makemigrations
This commit is contained in:
1 parent
26a8aaa993
commit
5f11f9417f
3 files changed
+18
-11
No files matched your search
@@ -1,3 +1,6 @@
|
||||
import logging
|
||||
|
||||
|
||||
def register_linting_configuration_options(parser):
|
||||
parser.add_argument(
|
||||
"--database",
|
||||
@@ -21,3 +24,14 @@ def register_linting_configuration_options(parser):
|
||||
action="store_true",
|
||||
help="handle warnings as errors",
|
||||
)
|
||||
|
||||
|
||||
def configure_logging(verbosity):
|
||||
logger = logging.getLogger("django_migration_linter")
|
||||
|
||||
if verbosity > 1:
|
||||
logging.basicConfig(format="%(message)s", level=logging.DEBUG)
|
||||
elif verbosity == 0:
|
||||
logger.disabled = True
|
||||
else:
|
||||
logging.basicConfig(format="%(message)s")
|
||||
Reference in new issue
Block a user