From 34de3bc5bddc24ede794215ce0bb4283cb874341 Mon Sep 17 00:00:00 2001 From: Askaholic Date: Thu, 6 Jun 2019 23:21:58 -0800 Subject: [PATCH] Issue/#437 Add timestamps to logs (#441) * Add timestamp to logs * Remove module name from loggers * Remove unused import --- server.py | 6 ++++-- server/decorators.py | 3 --- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/server.py b/server.py index eb25d33e6..1911fc413 100755 --- a/server.py +++ b/server.py @@ -22,7 +22,6 @@ from server.geoip_service import GeoIpService from server.ice_servers.nts import TwilioNTS from server.ladder_service import LadderService -from server.matchmaker import MatchmakerQueue from server.player_service import PlayerService from server.stats.game_stats_service import (AchievementService, EventService, GameStatsService) @@ -30,7 +29,10 @@ if __name__ == '__main__': logger = logging.getLogger() stderr_handler = logging.StreamHandler() - stderr_handler.setFormatter(logging.Formatter('%(levelname)-8s %(name)-30s %(message)s')) + stderr_handler.setFormatter(logging.Formatter( + fmt='%(levelname)-8s %(asctime)s %(name)-30s %(message)s', + datefmt='%b %d %H:%M:%S' + )) logger.addHandler(stderr_handler) logger.setLevel(config.LOG_LEVEL) diff --git a/server/decorators.py b/server/decorators.py index 3a7d1c381..e78361b11 100644 --- a/server/decorators.py +++ b/server/decorators.py @@ -8,9 +8,6 @@ def with_logger(cls): attr_name = '_logger' cls_name = cls.__qualname__ - module = cls.__module__ - assert module is not None - cls_name = module + '.' + cls_name setattr(cls, attr_name, logging.getLogger(cls_name)) return cls