diff options
author | Vadim Yanitskiy <axilirator@gmail.com> | 2018-12-07 09:34:00 +0700 |
---|---|---|
committer | Vadim Yanitskiy <axilirator@gmail.com> | 2018-12-08 02:10:20 +0700 |
commit | cdf349bc645d36645dab13e3f975b4deafbee579 (patch) | |
tree | d95353262111509d5fbbf8caecb32da42662a8bb /src/target/trx_toolkit/burst_send.py | |
parent | 5cb7e287ed120f228de90cc05dec1b9d8092174e (diff) |
trx_toolkit: introduce logging configuration arguments
Before this change, it was impossible to configure logging
parameters from command line, such as log level and format.
This change introduces the following optional arguments:
--log-level - logging level for stderr (by default, DEBUG);
--log-format - logging message format for stderr;
--log-file-name - enable logging to a given file;
--log-file-level - logging level for file (by default, DEBUG);
--log-file-format - logging message format for file;
which are defined in a new class called ApplicationBase, so
all existing applications should inherit them now.
Change-Id: Ic3b0440cd73946ad444bd7e48feb7a92d45f6488
Diffstat (limited to 'src/target/trx_toolkit/burst_send.py')
-rwxr-xr-x | src/target/trx_toolkit/burst_send.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/target/trx_toolkit/burst_send.py b/src/target/trx_toolkit/burst_send.py index 499e929d..16db222f 100755 --- a/src/target/trx_toolkit/burst_send.py +++ b/src/target/trx_toolkit/burst_send.py @@ -30,12 +30,13 @@ import signal import argparse import sys +from app_common import ApplicationBase from data_dump import DATADumpFile from data_if import DATAInterface from gsm_shared import * from data_msg import * -class Application: +class Application(ApplicationBase): def __init__(self): print_copyright(CR_HOLDERS) self.argv = self.parse_argv() @@ -44,8 +45,7 @@ class Application: signal.signal(signal.SIGINT, self.sig_handler) # Configure logging - log.basicConfig(level = log.DEBUG, - format = "[%(levelname)s] %(filename)s:%(lineno)d %(message)s") + self.app_init_logging(self.argv) # Open requested capture file self.ddf = DATADumpFile(self.argv.capture_file) @@ -106,6 +106,9 @@ class Application: parser = argparse.ArgumentParser(prog = "burst_send", description = "Auxiliary tool to send (reply) captured bursts") + # Register common logging options + self.app_reg_logging_options(parser) + trx_group = parser.add_argument_group("TRX interface") trx_group.add_argument("-r", "--remote-addr", dest = "remote_addr", type = str, default = "127.0.0.1", |