From cb9dde05f22933f3b959fad60483c0dd9fe18cb3 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Tue, 9 Jun 2015 18:33:36 +0300 Subject: test/800-38a.py: change default log file name --- test/800-38a.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/800-38a.py b/test/800-38a.py index 64a5cd0..4a785de 100644 --- a/test/800-38a.py +++ b/test/800-38a.py @@ -2,7 +2,10 @@ # This file is licensed under the terms of the MIT License. # See LICENSE.txt for details. -import toolkit, unittest +from datetime import datetime +import logging +import toolkit +import unittest _plaintexts = ['6bc1bee22e409f96e93d7e117393172a', 'ae2d8a571e03ac9c9eb76fac45af8e51', @@ -137,11 +140,13 @@ if __name__ == '__main__': tools = toolkit.Tools(args.root, args.sde) - import logging, logging.handlers + logging_options = {'format': '%(asctime)s | %(module)s | %(levelname)s | %(message)s', + 'level': logging.DEBUG} if args.log is None: - logging.getLogger().addHandler(logging.NullHandler()) + logging_options['filename'] = datetime.now().strftime('800-38a_%Y-%m-%d_%H-%M-%S.log') else: - logging.basicConfig(filename=args.log, format='%(asctime)s | %(module)s | %(message)s', level=logging.DEBUG) + logging_options['filename'] = args.log + logging.basicConfig(**logging_options) suite = unittest.TestSuite() for algo in _ciphertexts: -- cgit v1.2.3