find_outside_stacklevel

lsst.utils.introspection.find_outside_stacklevel(module_name: str) int

Find the stacklevel for outside of the given module.

This can be used to determine the stacklevel parameter that should be passed to log messages or warnings in order to make them appear to come from external code and not this package.

Parameters:
module_namestr

The name of the module to base the stack level calculation upon.

Returns:
stacklevelint

The stacklevel to use matching the first stack frame outside of the given module.