From 37954e432c0a8fe0624ce955468940e9548504d2 Mon Sep 17 00:00:00 2001 From: Marcus Stoegbauer Date: Sat, 30 Mar 2024 21:40:58 +0100 Subject: [PATCH] adjusted start/end debug output for functions, print directory name and end marker --- userconfig/__init__.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/userconfig/__init__.py b/userconfig/__init__.py index 3e0100f..f4768a8 100644 --- a/userconfig/__init__.py +++ b/userconfig/__init__.py @@ -23,7 +23,7 @@ class Userconfig: :return: str """ content = [] - self._cfg.debug.stdout(" ================ build_file ===============", 1) + self._cfg.debug.stdout(f" ================ build_file {destfile} ===============", 1) if commentstring != "": self._cfg.debug.stdout(" +++ commentstring found, adding header.", 3) content.append(commentstring + " " + self._cfg.get("stamp") + " " + time.strftime("%+") + "\n") @@ -54,7 +54,7 @@ class Userconfig: fp.write(block) fp.write("\n") fp.close() - self._cfg.debug.stdout(" ================ build_file ===============", 1) + self._cfg.debug.stdout(f" ================ done: build_file {destfile} ===============", 1) return tempfilename def process_all_files(self, destfiles, dir_config): @@ -100,8 +100,7 @@ class Userconfig: """walks through directory, collecting all filenames, returns list of all filenames""" dirs = os.listdir(directory) ret = [] - self._cfg.debug.stdout(" ================ workconf ===============", 1) - self._cfg.debug.stdout(" Finding files in directory %s." % directory, 4) + self._cfg.debug.stdout(f" ================ workconf {directory} ===============", 1) for d in dirs: name = directory + "/" + d if os.path.isdir(name): @@ -112,7 +111,7 @@ class Userconfig: continue ret.append(name) self._cfg.debug.stdout(" +++ Found file %s in directory %s" % (name, directory), 4) - self._cfg.debug.stdout(" ================ workconf ===============", 1) + self._cfg.debug.stdout(f" ================ done: workconf {directory} ===============", 1) return ret def workdir(self, directory): @@ -120,8 +119,7 @@ class Userconfig: then collect all filenames within this directory and return a dict of all files for this directory """ - self._cfg.debug.stdout(" ================ workdir ===============", 1) - self._cfg.debug.stdout(" Working on directory %s" % directory, 3) + self._cfg.debug.stdout(f" ================ workdir {directory} ===============", 1) # skip directory if no CONFIGFILE present if not os.path.isfile(directory+"/"+self._cfg.get("configfile")): self._cfg.debug.stdout(f' --- No file {self._cfg.get("configfile")} in {directory}, skipping.', 1) @@ -171,5 +169,5 @@ class Userconfig: f"{destfiles[destname]}", 4) self._cfg.debug.stdout(" === workdir: %s, Files: %s" % (directory, str(destfiles)), 3) - self._cfg.debug.stdout(" ================ workdir ===============", 1) + self._cfg.debug.stdout(f" ================ done: workdir {directory} ===============", 1) return destfiles, dir_config