Last Updated: June 08, 2023
·
28.07K
· emjayess

Console Stack-tracing Invoked Javascript Function Names

// Note: arguments.callee.name is a deprecated thing, so ymmv...

function __invoked(fn) {
    if (fn === '') {
        fn = 'anonymous'
    }

    console.trace(' >>> invoked: %s()]', fn)
}

function doWhatever() {
    __invoked(arguments.callee.name)

    // function code...
}