From d25d8c2e06e17b55a37d074e19965238d3d47967 Mon Sep 17 00:00:00 2001 From: Haofan Zheng Date: Sun, 15 Oct 2023 16:33:58 -0700 Subject: [PATCH] Added version print out to log --- GradescopeGrader/Grader.py | 10 ++++++++++ runtests.py | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/GradescopeGrader/Grader.py b/GradescopeGrader/Grader.py index 1de4291..75ef72b 100644 --- a/GradescopeGrader/Grader.py +++ b/GradescopeGrader/Grader.py @@ -9,11 +9,13 @@ import json +import logging import os from typing import List, Union from . import Test +from . import _Meta class Grader(object): @@ -23,6 +25,14 @@ def __init__(self) -> None: self.tests: List[Test.Test] = [] + self.logger = logging.getLogger( + __name__ + '.' + self.__class__.__name__ + ) + self.logger.info('{} version {}'.format( + _Meta.PKG_NAME, + _Meta.__version__, + )) + def AddTest(self, test: Test.Test) -> None: self.tests.append(test) diff --git a/runtests.py b/runtests.py index 1ec26bc..3eaf212 100644 --- a/runtests.py +++ b/runtests.py @@ -8,9 +8,15 @@ ### +import logging + from tests.unittest import main if __name__ == '__main__': + logging.basicConfig( + level=logging.DEBUG, + format='%(asctime)s %(name)s[%(levelname)s]: %(message)s', + ) main()