Skip to content
Snippets Groups Projects
Commit f0cfc22c authored by Izzard, Robert Dr (Maths & Physics)'s avatar Izzard, Robert Dr (Maths & Physics)
Browse files

improve newline passing

parent 7b2842ae
No related branches found
No related tags found
No related merge requests found
...@@ -373,7 +373,7 @@ def call_binary_c_config(argument): ...@@ -373,7 +373,7 @@ def call_binary_c_config(argument):
def verbose_print(message: str, def verbose_print(message: str,
verbosity: int, verbosity: int,
minimal_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 Function that decides whether to print a message based on the current verbosity
and its minimum verbosity and its minimum verbosity
...@@ -384,6 +384,7 @@ def verbose_print(message: str, ...@@ -384,6 +384,7 @@ def verbose_print(message: str,
message: message to print message: message to print
verbosity: current verbosity level verbosity: current verbosity level
minimal_verbosity: threshold verbosity above which to print 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: if verbosity >= minimal_verbosity:
......
...@@ -274,7 +274,7 @@ class grid_logging(): ...@@ -274,7 +274,7 @@ class grid_logging():
mem_use=total_mem_use, mem_use=total_mem_use,
system_string_colour=self.ANSI_colours["yellow"], system_string_colour=self.ANSI_colours["yellow"],
system_string=system_string, system_string=system_string,
closing_colour=self.ANSI_colours["reset"], closing_colour=self.ANSI_colours["reset"]
), ),
self.grid_options["verbosity"], self.grid_options["verbosity"],
1, 1,
...@@ -295,8 +295,7 @@ class grid_logging(): ...@@ -295,8 +295,7 @@ class grid_logging():
mem_use=total_mem_use, mem_use=total_mem_use,
system_string_colour=self.ANSI_colours["yellow"], system_string_colour=self.ANSI_colours["yellow"],
system_string=system_string, system_string=system_string,
closing_colour=self.ANSI_colours["reset"], closing_colour=self.ANSI_colours["reset"]
newline=self.grid_options["log_newline"]
), ),
self.grid_options["verbosity"], self.grid_options["verbosity"],
1, 1,
...@@ -313,6 +312,11 @@ class grid_logging(): ...@@ -313,6 +312,11 @@ class grid_logging():
) )
def verbose_print(self,*args,**kwargs): 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) binarycpython.utils.functions.verbose_print(*args,**kwargs)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment