elapsed = time.perf_counter() - start; logging.getLogger(__name__).debug(f'{func.__name__} finished in {elapsed:.4f}s')
Decorators & Metaclasses

Meaning

Measures elapsed time using time.perf_counter and logs a debug message with the function name and duration.

Primary Function

Measure and log the execution duration of a function at debug level.

Communicative Purpose

Inform developers about function performance during debugging or profiling.

Função primária

Measure and log the execution duration of a function at debug level.

Propósito comunicativo

Inform developers about function performance during debugging or profiling.

Situações de gatilho

When wrapping a function call or placing inside a function body to monitor its execution time for debugging or performance tuning.

Contextos

Used inside a function wrapper, decorator, or directly within a function to log its own execution time.

Família do chunk

  • py-timer-decorator
  • py-timer-context-manager
  • py-logging-debug

Upgrade path

Use a reusable timing decorator or context manager for reusable timing logic.

Tag de espaçamento: Short-term

Log in to save chunks.