@@ -176,33 +176,37 @@ def load(cls, args) -> None:
176176 full_config_path = full_config_path .parent / (full_config_path .stem + "_DEBUG.json" )
177177 with open (full_config_path , 'w' if full_config_path .exists () else 'x' , encoding = 'utf-8' ) as debug_file :
178178 json .dump (cls .parse_config_jsonstr (), debug_file , indent = 4 )
179- Printer .hashtaged (PrintChannel .MANDATORY , f"{ full_config_path .name } saved to { full_config_path .resolve ().parent } " )
179+ real_debug = cls .Values [DEBUG ]; cls .Values [DEBUG ] = True
180+ Printer .hashtaged (PrintChannel .DEBUG , f"{ full_config_path .name } saved to { full_config_path .resolve ().parent } " )
181+ cls .Values [DEBUG ] = real_debug
180182
181183 # Override config from commandline arguments
182184 for key in CONFIG_VALUES :
183185 if key .lower () in vars (args ) and vars (args )[key .lower ()] is not None :
184186 cls .Values [key ] = cls .parse_arg_value (key , vars (args )[key .lower ()])
185187
188+ # Handle sub-library logging
189+ if cls .debug ():
190+ logfile = Path (cls .get_root_path ()/ f"zotify_DEBUG_{ Zotify .DATETIME_LAUNCH } .log" )
191+ Printer .hashtaged (PrintChannel .DEBUG , f"{ logfile .name } logging to { logfile .resolve ().parent } " )
192+ logging .basicConfig (level = logging .DEBUG , filemode = "x" , filename = logfile )
193+ cls .logger = logging .getLogger ("zotify.debug" )
194+ else :
195+ logging .basicConfig (level = logging .CRITICAL )
196+ # mutedLoggers = {"Librespot:Session", "Librespot:AudioKeyManager", "librespot.audio", "Librespot:CdnManager"}
197+ # for logger in mutedLoggers:
198+ # logging.getLogger(logger).disabled = True
199+
186200 # Confirm regex patterns
187201 if cls .get_regex_enabled ():
188202 for mode in ["Track" , "Episode" , "Album" ]:
189203 regex_method : Callable [[None ], None | re .Pattern ] = getattr (cls , f"get_regex_{ mode .lower ()} " )
190- if regex_method (): Printer .hashtaged (PrintChannel .MANDATORY , f'{ mode } Regex Filter: r"{ regex_method ().pattern } "' )
204+ if regex_method (): Printer .hashtaged (PrintChannel .DEBUG , f'{ mode } Regex Filter: r"{ regex_method ().pattern } "' )
191205
192206 # Check no-splash
193207 if args .no_splash :
194208 cls .Values [PRINT_SPLASH ] = False
195209
196- # Handle sub-library logging
197- if cls .Values [DEBUG ]:
198- logfile = cls .get_root_path ()/ f"zotify_DEBUG_{ Zotify .DATETIME_LAUNCH } .log"
199- logging .basicConfig (level = logging .DEBUG , filemode = "x" , filename = logfile )
200- cls .logger = logging .getLogger ("zotify.debug" )
201- else :
202- logging .basicConfig (level = logging .CRITICAL )
203- # mutedLoggers = {"Librespot:Session", "Librespot:AudioKeyManager", "librespot.audio", "Librespot:CdnManager"}
204- # for logger in mutedLoggers:
205- # logging.getLogger(logger).disabled = True
206210
207211 @classmethod
208212 def get_default_json (cls ) -> dict :
0 commit comments