asterisk / asterisk

The official Asterisk Project repository.
https://www.asterisk.org
Other
1.97k stars 924 forks source link

logger.h: Add SCOPE_CALL and SCOPE_CALL_WITH_RESULT #711

Closed gtjoseph closed 4 weeks ago

gtjoseph commented 1 month ago

If you're tracing a large function that may call another function multiple times in different circumstances, it can be difficult to see from the trace output exactly which location that function was called from. There's no good way to automatically determine the calling location. SCOPE_CALL and SCOPE_CALL_WITH_RESULT simply print out a trace line before and after the call.

The difference between SCOPE_CALL and SCOPE_CALL_WITH_RESULT is that SCOPE_CALL ignores the function's return value (if any) where SCOPE_CALL_WITH_RESULT allows you to specify the type of the function's return value so it can be assigned to a variable. SCOPE_CALL_WITH_INT_RESULT is just a wrapper for SCOPE_CALL_WITH_RESULT and the "int" return type.

gtjoseph commented 1 month ago

cherry-pick-to: 18 cherry-pick-to: 20 cherry-pick-to: 21

github-actions[bot] commented 4 weeks ago

Successfully merged to branch master and cherry-picked to ["18","20","21"]