Last Updated: July 20, 2021
·
14
· 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...
}