diff --git a/src/base/management/commands/correct_data.py b/src/base/management/commands/correct_data.py index 005623d7..8a917bce 100644 --- a/src/base/management/commands/correct_data.py +++ b/src/base/management/commands/correct_data.py @@ -11,7 +11,7 @@ from games.models import Game, Team from players.models import Player, Score -LOGGER = logging.getLogger('hbscorez.command') +LOGGER = logging.getLogger('hbscorez') class Command(BaseCommand): diff --git a/src/games/management/commands/import_games.py b/src/games/management/commands/import_games.py index 4caeda5a..e87f82fa 100644 --- a/src/games/management/commands/import_games.py +++ b/src/games/management/commands/import_games.py @@ -79,7 +79,7 @@ def import_league(self, league: League): try: self.import_game(game_row, league) except Exception: - logging.getLogger('mail').exception("Could not import Game") + LOGGER.exception("Could not import Game") def import_game(self, game_row, league: League): diff --git a/src/hbscorez/settings.py b/src/hbscorez/settings.py index a4238070..76e1d4cc 100644 --- a/src/hbscorez/settings.py +++ b/src/hbscorez/settings.py @@ -136,6 +136,7 @@ 'formatter': 'simple', }, 'mail': { + 'level': 'ERROR', 'class': 'django.utils.log.AdminEmailHandler', 'include_html': True, # 'reporter_class': 'base.error_reporter.CustomErrorReporter', # new in django 3 @@ -143,13 +144,10 @@ }, 'loggers': { 'hbscorez': { - 'handlers': ['file', 'console'], + 'handlers': ['file', 'console', 'mail'], 'level': 'DEBUG', 'propagate': True, }, - 'mail': { - 'handlers': ['mail'], - }, }, } diff --git a/src/leagues/management/commands/setup.py b/src/leagues/management/commands/setup.py index 3cb6e8b1..8d02a3d3 100644 --- a/src/leagues/management/commands/setup.py +++ b/src/leagues/management/commands/setup.py @@ -62,7 +62,7 @@ def scrape_associations(options): try: scrape_association(bhv_id, options) except Exception: - logging.getLogger('mail').exception("Could not create Association") + LOGGER.exception("Could not create Association") def scrape_association(bhv_id: int, options): @@ -98,7 +98,7 @@ def scrape_districs(association: Association, options): try: scrape_district(item, association, options) except Exception: - logging.getLogger('mail').exception("Could not create District") + LOGGER.exception("Could not create District") def scrape_district(district_item, association: Association, options): @@ -125,7 +125,7 @@ def scrape_district(district_item, association: Association, options): try: scrape_season(district, start_year, options) except Exception: - logging.getLogger('mail').exception("Could not create Season") + LOGGER.exception("Could not create Season") def scrape_season(district, start_year, options): @@ -155,7 +155,7 @@ def scrape_season(district, start_year, options): try: scrape_league(league_link, district, season, options) except Exception: - logging.getLogger('mail').exception("Could not create League") + LOGGER.exception("Could not create League") @transaction.atomic diff --git a/src/leagues/tests/integration/test_setup_league.py b/src/leagues/tests/integration/test_setup_league.py index 3de13bfd..a62edb41 100644 --- a/src/leagues/tests/integration/test_setup_league.py +++ b/src/leagues/tests/integration/test_setup_league.py @@ -93,7 +93,7 @@ def test_no_youth(self): class LongLeagueNames(IntegrationTestCase): - def test_youth(self): + def test_long(self): self.assert_command('setup', '-a', 83, '-d', 83, '-s', 2019, '-l', 45646, 45651, '--youth') leagues = self.assert_objects(League, count=2).order_by('name') diff --git a/src/players/management/commands/import_reports.py b/src/players/management/commands/import_reports.py index 0c7cc315..ac0a403c 100644 --- a/src/players/management/commands/import_reports.py +++ b/src/players/management/commands/import_reports.py @@ -84,7 +84,7 @@ def import_league(self, league): try: self.import_game(game) except Exception: - logging.getLogger('mail').exception("Could not import Report") + LOGGER.exception("Could not import Report") def import_game(self, game: Game): if self.options['games'] and game.number not in self.options['games']: