diff --git a/binarycpython/utils/functions.py b/binarycpython/utils/functions.py index 875398fe9231be171ac4c288c94ac3388e663ef1..304672866687b04cb850ebcbc76b7341357bc76e 100644 --- a/binarycpython/utils/functions.py +++ b/binarycpython/utils/functions.py @@ -373,7 +373,7 @@ def call_binary_c_config(argument): def verbose_print(message: str, verbosity: int, minimal_verbosity: int, - newline = "\n") -> None: + newline: str = "\n") -> None: """ Function that decides whether to print a message based on the current verbosity and its minimum verbosity @@ -384,6 +384,7 @@ def verbose_print(message: str, message: message to print verbosity: current verbosity level minimal_verbosity: threshold verbosity above which to print + newline: newline character (or set of characters), defaults to "\n" but "\x0d" (carriage return) might be useful. """ if verbosity >= minimal_verbosity: diff --git a/binarycpython/utils/grid_logging.py b/binarycpython/utils/grid_logging.py index e843e0744981a2fa876007398583470fe59ba8d0..f0cbbd85bd00bdbe525d213ce40d998b9ae20a16 100644 --- a/binarycpython/utils/grid_logging.py +++ b/binarycpython/utils/grid_logging.py @@ -274,7 +274,7 @@ class grid_logging(): mem_use=total_mem_use, system_string_colour=self.ANSI_colours["yellow"], system_string=system_string, - closing_colour=self.ANSI_colours["reset"], + closing_colour=self.ANSI_colours["reset"] ), self.grid_options["verbosity"], 1, @@ -295,8 +295,7 @@ class grid_logging(): mem_use=total_mem_use, system_string_colour=self.ANSI_colours["yellow"], system_string=system_string, - closing_colour=self.ANSI_colours["reset"], - newline=self.grid_options["log_newline"] + closing_colour=self.ANSI_colours["reset"] ), self.grid_options["verbosity"], 1, @@ -313,6 +312,11 @@ class grid_logging(): ) def verbose_print(self,*args,**kwargs): + # wrapper for functions.verbose_print to use the correct newline + newline = kwargs.get("newline",self.grid_options["log_newline"]) + if newline is None: + newline = "\n" + kwargs["newline"] = newline binarycpython.utils.functions.verbose_print(*args,**kwargs)