def test_functions(self): logger = Logger() @logger(flag='TEST', format='{fname}({args})={result}') def f(a=10, b=20): return a + b @logger(format='{fname} -> {result}') def g(a=10, b=20): return a * b f() f(5, 5) g() g(5, 5) expected_log = "f(a = 10,b = 20)=30\nf(a = 5,b = 5)=10\ng -> 200\ng -> 25" self.assertEqual(str(logger), expected_log) logger.clear() self.assertEqual(str(logger), '')
def __init__(self): Logger.__init__(self, format="{fname}(..) => {result}")
def __init__(self): Logger.__init__(self, format='A.{fname} -> {result}')