From 521c6cd52ab700350d8682e3b5efa4ad3abebfba Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Wed, 5 Jun 2024 11:03:46 -0400 Subject: [PATCH] membershipworks: Allow setting verbosity in `scrape_events` command --- .../management/commands/scrape_events.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/membershipworks/management/commands/scrape_events.py b/membershipworks/management/commands/scrape_events.py index c12ac36..8c0d562 100644 --- a/membershipworks/management/commands/scrape_events.py +++ b/membershipworks/management/commands/scrape_events.py @@ -1,8 +1,18 @@ +import logging + from django.core.management.base import BaseCommand -from membershipworks.tasks.scrape import scrape_events +from membershipworks.tasks.scrape import logger, scrape_events class Command(BaseCommand): - def handle(self, *args, **options): + def handle(self, *args, verbosity: int, **options): + verbosity_levels = { + 0: logging.ERROR, + 1: logging.WARNING, + 2: logging.INFO, + 3: logging.DEBUG, + } + logger.setLevel(verbosity_levels.get(verbosity, logging.WARNING)) + scrape_events()