1 Reply Latest reply on Feb 4, 2008 5:06 AM by garyrgi

    Find the Calling Function

      How can I find out what function called my function?

      I have written a utility component (test1 below) and want to keep track of what external functions call the functions within my component. Other programmers create a component (e.g. test2 below) that extends my utility component and then their functions call my functions. I want to record metric data to determine how much use my functions are getting and from where. I've used the getMetaData() function inside my functions, but that only gives me the name of the component that extends my component (in this case test2), not the specific function that called my function (in this case functionAtest2).

      <cffunction name="functionAtest1" returntype="string">
      <cfoutput>from method functionAtest1<br></cfoutput>
      <cfdump var="#getMetaData(this)#" ></cfoutput>
      <cfreturn "functionAtest1">

      <cfcomponent extends="test1">
      <cffunction name="functionAtest2" returntype="string">
      <cfset functionAtest1()>
      <cfoutput>from method functionAtest2<br></cfoutput>
      <cfreturn "functionAtest2">

      <cffunction name="functionBtest2" returntype="string">
      <cfreturn "functionBtest2">