-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add only_parameter
and exclude_parameter
to @debug
decorator
#17
base: develop
Are you sure you want to change the base?
Conversation
# Add ellipsis in the middle to indicate omitted parameters | ||
kwargs_repr.insert(len(kwargs_repr) // 2, "[...]") | ||
signature = ", ".join(kwargs_repr) | ||
logger.info(f"CALLING {func.__name__}({signature})") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logger.info(f"CALLING {func.__name__}({signature})") | |
logger.debug(f"CALLING {func.__name__}({signature})") |
Why we don't use the debug logger if the decorator is called @debug
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the one hand because the default level of the viur-toolkit is info
and a debug log is only displayed after manually lowering the level. Then you would use the debug
decorator and see nothing. To avoid confusion and not having to switch a second lever to get the desired output, this is info
.
Furthermore, debug
logs are there to get low-level information (regarding the behavior) of a software. Here, however, the aim is not to obtain information within the viur-toolkit, but to obtain information at the high-level user level of the viur-toolkit. Hence info.
The correct way would be that the project would have to pass or pre-configure the project logger here. But IMO that goes way too far for a small helper.
value = func(*args, **kwargs) | ||
logging.info(f"{func.__name__} RETURNED {value}") | ||
logger.info(f"{func.__name__} RETURNED {value!r}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logger.info(f"{func.__name__} RETURNED {value!r}") | |
logger.debug(f"{func.__name__} RETURNED {value!r}") |
Here too?
No description provided.