182
183 annotations = func.__annotations__
184 params = OrderedDict()
185 logger.debug("Annotations: {}".format(annotations))186
187 for p, t in annotations.items():
188 if p == skip_var:
125 params = OrderedDict(
126 [(k, None) for k in getfullargspec(func).args if k != skip_var]
127 )
128 logger.debug("Params: {}".format(params))129
130 if getattr(func, "__annotations__", None):
131 params.update(parse_type_hints_from_annotations(func, skip_var=skip_var))
Formatting the message manually before passing it to a logging
call does unnecessary work if logging in disabled. Consider using the logging
module's built-in formatting features to avoid that.
import logging, inspect
logging.basicConfig(level=logging.INFO)
logging.debug("Entered function {}".format(inspect.stack[0][3]))
import logging, inspect
logging.basicConfig(level=logging.INFO)
logging.debug("Entered function %s", inspect.stack[0][3])