Add command line support for LOG_LEVEL and LOG_HANDLERS
This commit is contained in:
parent
42cb1fa4c7
commit
5bebad3e1b
@ -636,6 +636,8 @@ if __name__ == '__main__':
|
|||||||
# CLI argument parser - handles picking up the config file from the command line, and sending a "help" message
|
# CLI argument parser - handles picking up the config file from the command line, and sending a "help" message
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('-c', '--config', action='store', dest='CFG_FILE', help='/full/path/to/config.file (usually dmrlink.cfg)')
|
parser.add_argument('-c', '--config', action='store', dest='CFG_FILE', help='/full/path/to/config.file (usually dmrlink.cfg)')
|
||||||
|
parser.add_argument('-ll', '--log_level', action='store', dest='LOG_LEVEL', help='Override config file logging level.')
|
||||||
|
parser.add_argument('-lh', '--log_handle', action='store', dest='LOG_HANDLERS', help='Override config file logging handler.')
|
||||||
cli_args = parser.parse_args()
|
cli_args = parser.parse_args()
|
||||||
|
|
||||||
if not cli_args.CFG_FILE:
|
if not cli_args.CFG_FILE:
|
||||||
@ -645,6 +647,10 @@ if __name__ == '__main__':
|
|||||||
CONFIG = dmrlink_config.build_config(cli_args.CFG_FILE)
|
CONFIG = dmrlink_config.build_config(cli_args.CFG_FILE)
|
||||||
|
|
||||||
# Call the external routing to start the system logger
|
# Call the external routing to start the system logger
|
||||||
|
if cli_args.LOG_LEVEL:
|
||||||
|
CONFIG['LOGGER']['LOG_LEVEL'] = cli_args.LOG_LEVEL
|
||||||
|
if cli_args.LOG_HANDLERS:
|
||||||
|
CONFIG['LOGGER']['LOG_HANDLERS'] = cli_args.LOG_HANDLERS
|
||||||
logger = dmrlink_log.config_logging(CONFIG['LOGGER'])
|
logger = dmrlink_log.config_logging(CONFIG['LOGGER'])
|
||||||
|
|
||||||
logger.info('DMRlink \'ambe_audio.py\' (c) 2015 N0MJS & the K0USY Group - SYSTEM STARTING...')
|
logger.info('DMRlink \'ambe_audio.py\' (c) 2015 N0MJS & the K0USY Group - SYSTEM STARTING...')
|
||||||
|
@ -454,6 +454,8 @@ if __name__ == '__main__':
|
|||||||
# CLI argument parser - handles picking up the config file from the command line, and sending a "help" message
|
# CLI argument parser - handles picking up the config file from the command line, and sending a "help" message
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('-c', '--config', action='store', dest='CFG_FILE', help='/full/path/to/config.file (usually dmrlink.cfg)')
|
parser.add_argument('-c', '--config', action='store', dest='CFG_FILE', help='/full/path/to/config.file (usually dmrlink.cfg)')
|
||||||
|
parser.add_argument('-ll', '--log_level', action='store', dest='LOG_LEVEL', help='Override config file logging level.')
|
||||||
|
parser.add_argument('-lh', '--log_handle', action='store', dest='LOG_HANDLERS', help='Override config file logging handler.')
|
||||||
cli_args = parser.parse_args()
|
cli_args = parser.parse_args()
|
||||||
|
|
||||||
if not cli_args.CFG_FILE:
|
if not cli_args.CFG_FILE:
|
||||||
@ -462,6 +464,13 @@ if __name__ == '__main__':
|
|||||||
# Call the external routine to build the configuration dictionary
|
# Call the external routine to build the configuration dictionary
|
||||||
CONFIG = dmrlink_config.build_config(cli_args.CFG_FILE)
|
CONFIG = dmrlink_config.build_config(cli_args.CFG_FILE)
|
||||||
|
|
||||||
|
# Call the external routing to start the system logger
|
||||||
|
if cli_args.LOG_LEVEL:
|
||||||
|
CONFIG['LOGGER']['LOG_LEVEL'] = cli_args.LOG_LEVEL
|
||||||
|
if cli_args.LOG_HANDLERS:
|
||||||
|
CONFIG['LOGGER']['LOG_HANDLERS'] = cli_args.LOG_HANDLERS
|
||||||
|
logger = dmrlink_log.config_logging(CONFIG['LOGGER'])
|
||||||
|
|
||||||
# Call the external routing to start the system logger
|
# Call the external routing to start the system logger
|
||||||
logger = dmrlink_log.config_logging(CONFIG['LOGGER'])
|
logger = dmrlink_log.config_logging(CONFIG['LOGGER'])
|
||||||
|
|
||||||
|
@ -382,6 +382,8 @@ if __name__ == '__main__':
|
|||||||
# CLI argument parser - handles picking up the config file from the command line, and sending a "help" message
|
# CLI argument parser - handles picking up the config file from the command line, and sending a "help" message
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('-c', '--config', action='store', dest='CFG_FILE', help='/full/path/to/config.file (usually dmrlink.cfg)')
|
parser.add_argument('-c', '--config', action='store', dest='CFG_FILE', help='/full/path/to/config.file (usually dmrlink.cfg)')
|
||||||
|
parser.add_argument('-ll', '--log_level', action='store', dest='LOG_LEVEL', help='Override config file logging level.')
|
||||||
|
parser.add_argument('-lh', '--log_handle', action='store', dest='LOG_HANDLERS', help='Override config file logging handler.')
|
||||||
cli_args = parser.parse_args()
|
cli_args = parser.parse_args()
|
||||||
|
|
||||||
if not cli_args.CFG_FILE:
|
if not cli_args.CFG_FILE:
|
||||||
@ -391,6 +393,10 @@ if __name__ == '__main__':
|
|||||||
CONFIG = dmrlink_config.build_config(cli_args.CFG_FILE)
|
CONFIG = dmrlink_config.build_config(cli_args.CFG_FILE)
|
||||||
|
|
||||||
# Call the external routing to start the system logger
|
# Call the external routing to start the system logger
|
||||||
|
if cli_args.LOG_LEVEL:
|
||||||
|
CONFIG['LOGGER']['LOG_LEVEL'] = cli_args.LOG_LEVEL
|
||||||
|
if cli_args.LOG_HANDLERS:
|
||||||
|
CONFIG['LOGGER']['LOG_HANDLERS'] = cli_args.LOG_HANDLERS
|
||||||
logger = dmrlink_log.config_logging(CONFIG['LOGGER'])
|
logger = dmrlink_log.config_logging(CONFIG['LOGGER'])
|
||||||
|
|
||||||
config_reports(CONFIG)
|
config_reports(CONFIG)
|
||||||
|
@ -940,6 +940,8 @@ if __name__ == '__main__':
|
|||||||
# CLI argument parser - handles picking up the config file from the command line, and sending a "help" message
|
# CLI argument parser - handles picking up the config file from the command line, and sending a "help" message
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('-c', '--config', action='store', dest='CFG_FILE', help='/full/path/to/config.file (usually dmrlink.cfg)')
|
parser.add_argument('-c', '--config', action='store', dest='CFG_FILE', help='/full/path/to/config.file (usually dmrlink.cfg)')
|
||||||
|
parser.add_argument('-ll', '--log_level', action='store', dest='LOG_LEVEL', help='Override config file logging level.')
|
||||||
|
parser.add_argument('-lh', '--log_handle', action='store', dest='LOG_HANDLERS', help='Override config file logging handler.')
|
||||||
cli_args = parser.parse_args()
|
cli_args = parser.parse_args()
|
||||||
|
|
||||||
if not cli_args.CFG_FILE:
|
if not cli_args.CFG_FILE:
|
||||||
@ -949,6 +951,10 @@ if __name__ == '__main__':
|
|||||||
CONFIG = build_config(cli_args.CFG_FILE)
|
CONFIG = build_config(cli_args.CFG_FILE)
|
||||||
|
|
||||||
# Call the external routing to start the system logger
|
# Call the external routing to start the system logger
|
||||||
|
if cli_args.LOG_LEVEL:
|
||||||
|
CONFIG['LOGGER']['LOG_LEVEL'] = cli_args.LOG_LEVEL
|
||||||
|
if cli_args.LOG_HANDLERS:
|
||||||
|
CONFIG['LOGGER']['LOG_HANDLERS'] = cli_args.LOG_HANDLERS
|
||||||
logger = config_logging(CONFIG['LOGGER'])
|
logger = config_logging(CONFIG['LOGGER'])
|
||||||
|
|
||||||
config_reports(CONFIG)
|
config_reports(CONFIG)
|
||||||
|
@ -147,6 +147,8 @@ if __name__ == '__main__':
|
|||||||
# CLI argument parser - handles picking up the config file from the command line, and sending a "help" message
|
# CLI argument parser - handles picking up the config file from the command line, and sending a "help" message
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('-c', '--config', action='store', dest='CFG_FILE', help='/full/path/to/config.file (usually dmrlink.cfg)')
|
parser.add_argument('-c', '--config', action='store', dest='CFG_FILE', help='/full/path/to/config.file (usually dmrlink.cfg)')
|
||||||
|
parser.add_argument('-ll', '--log_level', action='store', dest='LOG_LEVEL', help='Override config file logging level.')
|
||||||
|
parser.add_argument('-lh', '--log_handle', action='store', dest='LOG_HANDLERS', help='Override config file logging handler.')
|
||||||
cli_args = parser.parse_args()
|
cli_args = parser.parse_args()
|
||||||
|
|
||||||
if not cli_args.CFG_FILE:
|
if not cli_args.CFG_FILE:
|
||||||
@ -156,6 +158,10 @@ if __name__ == '__main__':
|
|||||||
CONFIG = dmrlink_config.build_config(cli_args.CFG_FILE)
|
CONFIG = dmrlink_config.build_config(cli_args.CFG_FILE)
|
||||||
|
|
||||||
# Call the external routing to start the system logger
|
# Call the external routing to start the system logger
|
||||||
|
if cli_args.LOG_LEVEL:
|
||||||
|
CONFIG['LOGGER']['LOG_LEVEL'] = cli_args.LOG_LEVEL
|
||||||
|
if cli_args.LOG_HANDLERS:
|
||||||
|
CONFIG['LOGGER']['LOG_HANDLERS'] = cli_args.LOG_HANDLERS
|
||||||
logger = dmrlink_log.config_logging(CONFIG['LOGGER'])
|
logger = dmrlink_log.config_logging(CONFIG['LOGGER'])
|
||||||
|
|
||||||
logger.info('DMRlink \'record.py\' (c) 2014 N0MJS & the K0USY Group - SYSTEM STARTING...')
|
logger.info('DMRlink \'record.py\' (c) 2014 N0MJS & the K0USY Group - SYSTEM STARTING...')
|
||||||
|
@ -128,6 +128,8 @@ if __name__ == '__main__':
|
|||||||
# CLI argument parser - handles picking up the config file from the command line, and sending a "help" message
|
# CLI argument parser - handles picking up the config file from the command line, and sending a "help" message
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('-c', '--config', action='store', dest='CFG_FILE', help='/full/path/to/config.file (usually dmrlink.cfg)')
|
parser.add_argument('-c', '--config', action='store', dest='CFG_FILE', help='/full/path/to/config.file (usually dmrlink.cfg)')
|
||||||
|
parser.add_argument('-ll', '--log_level', action='store', dest='LOG_LEVEL', help='Override config file logging level.')
|
||||||
|
parser.add_argument('-lh', '--log_handle', action='store', dest='LOG_HANDLERS', help='Override config file logging handler.')
|
||||||
cli_args = parser.parse_args()
|
cli_args = parser.parse_args()
|
||||||
|
|
||||||
if not cli_args.CFG_FILE:
|
if not cli_args.CFG_FILE:
|
||||||
@ -137,6 +139,10 @@ if __name__ == '__main__':
|
|||||||
CONFIG = dmrlink_config.build_config(cli_args.CFG_FILE)
|
CONFIG = dmrlink_config.build_config(cli_args.CFG_FILE)
|
||||||
|
|
||||||
# Call the external routing to start the system logger
|
# Call the external routing to start the system logger
|
||||||
|
if cli_args.LOG_LEVEL:
|
||||||
|
CONFIG['LOGGER']['LOG_LEVEL'] = cli_args.LOG_LEVEL
|
||||||
|
if cli_args.LOG_HANDLERS:
|
||||||
|
CONFIG['LOGGER']['LOG_HANDLERS'] = cli_args.LOG_HANDLERS
|
||||||
logger = dmrlink_log.config_logging(CONFIG['LOGGER'])
|
logger = dmrlink_log.config_logging(CONFIG['LOGGER'])
|
||||||
|
|
||||||
logger.info('DMRlink \'playback.py\' (c) 2013, 2014 N0MJS & the K0USY Group - SYSTEM STARTING...')
|
logger.info('DMRlink \'playback.py\' (c) 2013, 2014 N0MJS & the K0USY Group - SYSTEM STARTING...')
|
||||||
|
6
rcm.py
6
rcm.py
@ -163,6 +163,8 @@ if __name__ == '__main__':
|
|||||||
# CLI argument parser - handles picking up the config file from the command line, and sending a "help" message
|
# CLI argument parser - handles picking up the config file from the command line, and sending a "help" message
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('-c', '--config', action='store', dest='CFG_FILE', help='/full/path/to/config.file (usually dmrlink.cfg)')
|
parser.add_argument('-c', '--config', action='store', dest='CFG_FILE', help='/full/path/to/config.file (usually dmrlink.cfg)')
|
||||||
|
parser.add_argument('-ll', '--log_level', action='store', dest='LOG_LEVEL', help='Override config file logging level.')
|
||||||
|
parser.add_argument('-lh', '--log_handle', action='store', dest='LOG_HANDLERS', help='Override config file logging handler.')
|
||||||
cli_args = parser.parse_args()
|
cli_args = parser.parse_args()
|
||||||
|
|
||||||
if not cli_args.CFG_FILE:
|
if not cli_args.CFG_FILE:
|
||||||
@ -172,6 +174,10 @@ if __name__ == '__main__':
|
|||||||
CONFIG = dmrlink_config.build_config(cli_args.CFG_FILE)
|
CONFIG = dmrlink_config.build_config(cli_args.CFG_FILE)
|
||||||
|
|
||||||
# Call the external routing to start the system logger
|
# Call the external routing to start the system logger
|
||||||
|
if cli_args.LOG_LEVEL:
|
||||||
|
CONFIG['LOGGER']['LOG_LEVEL'] = cli_args.LOG_LEVEL
|
||||||
|
if cli_args.LOG_HANDLERS:
|
||||||
|
CONFIG['LOGGER']['LOG_HANDLERS'] = cli_args.LOG_HANDLERS
|
||||||
logger = dmrlink_log.config_logging(CONFIG['LOGGER'])
|
logger = dmrlink_log.config_logging(CONFIG['LOGGER'])
|
||||||
|
|
||||||
logger.info('DMRlink \'rcm.py\' (c) 2013, 2014 N0MJS & the K0USY Group - SYSTEM STARTING...')
|
logger.info('DMRlink \'rcm.py\' (c) 2013, 2014 N0MJS & the K0USY Group - SYSTEM STARTING...')
|
||||||
|
11
record.py
11
record.py
@ -119,6 +119,8 @@ if __name__ == '__main__':
|
|||||||
# CLI argument parser - handles picking up the config file from the command line, and sending a "help" message
|
# CLI argument parser - handles picking up the config file from the command line, and sending a "help" message
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('-c', '--config', action='store', dest='CFG_FILE', help='/full/path/to/config.file (usually dmrlink.cfg)')
|
parser.add_argument('-c', '--config', action='store', dest='CFG_FILE', help='/full/path/to/config.file (usually dmrlink.cfg)')
|
||||||
|
parser.add_argument('-ll', '--log_level', action='store', dest='LOG_LEVEL', help='Override config file logging level.')
|
||||||
|
parser.add_argument('-lh', '--log_handle', action='store', dest='LOG_HANDLERS', help='Override config file logging handler.')
|
||||||
cli_args = parser.parse_args()
|
cli_args = parser.parse_args()
|
||||||
|
|
||||||
if not cli_args.CFG_FILE:
|
if not cli_args.CFG_FILE:
|
||||||
@ -127,6 +129,15 @@ if __name__ == '__main__':
|
|||||||
# Call the external routine to build the configuration dictionary
|
# Call the external routine to build the configuration dictionary
|
||||||
CONFIG = dmrlink_config.build_config(cli_args.CFG_FILE)
|
CONFIG = dmrlink_config.build_config(cli_args.CFG_FILE)
|
||||||
|
|
||||||
|
# Call the external routing to start the system logger
|
||||||
|
if cli_args.LOG_LEVEL:
|
||||||
|
CONFIG['LOGGER']['LOG_LEVEL'] = cli_args.LOG_LEVEL
|
||||||
|
if cli_args.LOG_HANDLERS:
|
||||||
|
CONFIG['LOGGER']['LOG_HANDLERS'] = cli_args.LOG_HANDLERS
|
||||||
|
logger = dmrlink_log.config_logging(CONFIG['LOGGER'])
|
||||||
|
|
||||||
|
CONFIG = dmrlink_config.build_config(cli_args.CFG_FILE)
|
||||||
|
|
||||||
# Call the external routing to start the system logger
|
# Call the external routing to start the system logger
|
||||||
logger = dmrlink_log.config_logging(CONFIG['LOGGER'])
|
logger = dmrlink_log.config_logging(CONFIG['LOGGER'])
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user