Skip to content

Commit

Permalink
removed indentation since not necessary with logging
Browse files Browse the repository at this point in the history
  • Loading branch information
angelala3252 committed Jun 6, 2023
1 parent e325c2e commit 65fb226
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions openadapt/record.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,23 +53,20 @@ def kwargs_to_str(**kwargs):


def logging(func):
func.__indent__ = 0

@functools.wraps(func)
def wrapper_logging(*args, **kwargs):
func_indent = " " * func.__indent__
func.__indent__ += 2

func_name = func.__qualname__
func_args = args_to_str(*args)
func_kwargs = kwargs_to_str(**kwargs)

logger.info(f"{func_indent} -> Enter: {func_name}({func_args}",
extra={'func_kwargs': func_kwargs})
if func_kwargs != "":
logger.info(f" -> Enter: {func_name}({func_args}, {func_kwargs})")
else:
logger.info(f" -> Enter: {func_name}({func_args})")

result = func(*args, **kwargs)

logger.info(f"{func_indent} <- Leave: {func_name}({result})")
logger.info(f" <- Leave: {func_name}({result})")
return result

return wrapper_logging
Expand Down

0 comments on commit 65fb226

Please sign in to comment.