22 lines
601 B
Python
22 lines
601 B
Python
|
import logging
|
||
|
|
||
|
from django.core.management.base import BaseCommand
|
||
|
|
||
|
from doorcontrol.tasks.update_unifi_access import logger, update_access
|
||
|
|
||
|
|
||
|
class Command(BaseCommand):
|
||
|
def add_arguments(self, parser):
|
||
|
parser.add_argument("--dry-run", action="store_true")
|
||
|
|
||
|
def handle(self, *args, dry_run: bool, 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))
|
||
|
|
||
|
update_access()
|