diff options
Diffstat (limited to 'src/target/trx_toolkit/burst_gen.py')
-rwxr-xr-x | src/target/trx_toolkit/burst_gen.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/target/trx_toolkit/burst_gen.py b/src/target/trx_toolkit/burst_gen.py index d83f1378..9a17ffa9 100755 --- a/src/target/trx_toolkit/burst_gen.py +++ b/src/target/trx_toolkit/burst_gen.py @@ -26,6 +26,7 @@ from copyright import print_copyright CR_HOLDERS = [("2017-2018", "Vadim Yanitskiy <axilirator@gmail.com>")] +import logging as log import signal import getopt import sys @@ -64,6 +65,10 @@ class Application: # Set up signal handlers signal.signal(signal.SIGINT, self.sig_handler) + # Configure logging + log.basicConfig(level = log.DEBUG, + format = "[%(levelname)s] %(filename)s:%(lineno)d %(message)s") + # Open requested capture file if self.output_file is not None: self.ddf = DATADumpFile(self.output_file) @@ -130,7 +135,7 @@ class Application: # Set burst msg.burst = burst - print("[i] Sending %d/%d %s burst %s to %s..." + log.info("Sending %d/%d %s burst %s to %s..." % (i + 1, self.burst_count, self.burst_type, msg.desc_hdr(), self.conn_mode)) @@ -239,7 +244,7 @@ class Application: sys.exit(2) def sig_handler(self, signum, frame): - print("Signal %d received" % signum) + log.info("Signal %d received" % signum) if signum is signal.SIGINT: sys.exit(0) |