import inspect import os def log_entry(): """Print entry to file and method.""" frame = inspect.currentframe().f_back filename = os.path.basename(frame.f_code.co_filename) function_name = frame.f_code.co_name line = frame.f_lineno print(f"[{filename}:{line}] Entering {function_name}()")