if not cli_args.ConfigFile: cli_args.ConfigFile = os.path.dirname( os.path.abspath(__file__)) + '/dmrlink.cfg' if not cli_args.BridgeFile: cli_args.BridgeFile = os.path.dirname( os.path.abspath(__file__)) + '/dmrlink_ipsc_bridge.cfg' # Call the external routine to build the configuration dictionary config = build_config(cli_args.ConfigFile) # Call the external routing to start the system logger if cli_args.LogLevel: config['Log']['LogLevel'] = cli_args.LogLevel logger = config_logging(config['Log']) logger.debug('Logging system started, anything from here on gets logged') logger.info('Digital Voice Modem IPSC -> FNE Bridge Service D01.00') observer = log.PythonLoggingObserver() observer.start() # Make Dictionaries white_rids = mk_id_dict(config['Aliases']['Path'], config['Aliases']['WhitelistRIDsFile']) if white_rids: logger.info('ID MAPPER: white_rids dictionary is available') black_rids = mk_id_dict(config['Aliases']['Path'], config['Aliases']['BlacklistRIDsFile'])
help='Override config file logging handler.') cli_args = parser.parse_args() if not cli_args.CFG_FILE: cli_args.CFG_FILE = os.path.dirname( os.path.abspath(__file__)) + '/dmrlink.cfg' # Call the external routine to build the configuration dictionary 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 = config_logging(CONFIG['LOGGER']) logger.info( 'DMRlink \'dmrlink.py\' (c) 2013 - 2015 N0MJS & the K0USY Group - SYSTEM STARTING...' ) # Set signal handers so that we can gracefully exit if need be def sig_handler(_signal, _frame): logger.info('*** DMRLINK IS TERMINATING WITH SIGNAL %s ***', str(_signal)) for system in systems: systems[system].de_register_self() reactor.stop() for sig in [signal.SIGTERM, signal.SIGINT, signal.SIGQUIT]: signal.signal(sig, sig_handler)
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() if not cli_args.CFG_FILE: cli_args.CFG_FILE = os.path.dirname(os.path.abspath(__file__))+'/dmrlink.cfg' # Call the external routine to build the configuration dictionary 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 = config_logging(CONFIG['LOGGER']) logger.info('DMRlink \'dmrlink.py\' (c) 2013 - 2015 N0MJS & the K0USY Group - SYSTEM STARTING...') # Set signal handers so that we can gracefully exit if need be def sig_handler(_signal, _frame): logger.info('*** DMRLINK IS TERMINATING WITH SIGNAL %s ***', str(_signal)) for system in systems: systems[system].de_register_self() reactor.stop() for sig in [signal.SIGTERM, signal.SIGINT, signal.SIGQUIT]: signal.signal(sig, sig_handler) # INITIALIZE THE REPORTING LOOP report_server = config_reports(CONFIG, logger, reportFactory)