diff --git a/EDMarketConnector.py b/EDMarketConnector.py index 17cfdd01..b8887c6e 100755 --- a/EDMarketConnector.py +++ b/EDMarketConnector.py @@ -99,6 +99,12 @@ if __name__ == '__main__': # noqa: C901 action='append', ) + parser.add_argument( + '--trace-on', + help='Mark the selected trace logging as active.', + action='append', + ) + auth_options = parser.add_mutually_exclusive_group(required=False) auth_options.add_argument('--force-localserver-for-auth', help='Force EDMC to use a localhost webserver for Frontier Auth callback', @@ -146,6 +152,13 @@ if __name__ == '__main__': # noqa: C901 debug_webserver.run_listener(DEBUG_WEBSERVER_HOST, DEBUG_WEBSERVER_PORT) + if args.trace_on and len(args.trace_on) > 0: + import config as conf_module + + conf_module.trace_on = [x.casefold() for x in args.trace_on] # duplicate the list just in case + for d in conf_module.trace_on: + logger.info(f'marked {d} for TRACE') + def handle_edmc_callback_or_foregrounding() -> None: # noqa: CCR001 """Handle any edmc:// auth callback, else foreground existing window.""" logger.trace('Begin...') diff --git a/config.py b/config.py index 6e305edb..6b9d3016 100644 --- a/config.py +++ b/config.py @@ -41,6 +41,9 @@ update_feed = 'https://raw.githubusercontent.com/EDCD/EDMarketConnector/releases update_interval = 8*60*60 # Providers marked to be in debug mode. Generally this is expected to switch to sending data to a log file debug_senders: List[str] = [] +# TRACE logging code that should actually be used. Means not spamming it +# *all* if only interested in some things. +trace_on: List[str] = [] # This must be done here in order to avoid an import cycle with EDMCLogging. # Other code should use EDMCLogging.get_main_logger