Add --trace-on ... to activate specific trace logging

This is just the parsing and storage of the options for now.
This commit is contained in:
Athanasius committed 2021-08-05 13:43:15 +01:00
1 parent 9cb3bb1b69
commit 40b76d40cc
2 files changed
+16

No files matched your search

+13
View File
@@ -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...')
+3
View File
@@ -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