Skip to content

octoprint.util.dev#

This module provides a bunch of utility methods and helpers FOR DEVELOPMENT ONLY.

duration_log(context=None, log=None) #

Context manager to log the duration of the wrapped code block.

If no log function is provided will use a debug python logger for octoprint.util.dev.

context can be set to give some textual context in the output.

Parameters:

Name Type Description Default
context str

A custom string to give some textual context in the output.

None
log callable

The log function to use to log the execution duration.

None

log_duration(log=None, with_args=False) #

Decorator that logs the execution duration of the annotated function.

Parameters:

Name Type Description Default
log callable

The logging function to use.

None
with_args bool

Whether to include the calling arguments in the logged output or not.

False
Back to top