Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8358011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T10:39:57+00:00 2026-06-09T10:39:57+00:00

As I interact with my AJAX based application at RUNTIME I’d like the console

  • 0

As I interact with my AJAX based application at RUNTIME I’d like the console to spit out all the functions it’s calling. (so no stack trace, or breakpoints, or profiling or anything)

So for example, let’s say I pressed a button on the page. I’d like for it to return all the functions it
went through when that happened:

So I’d see in the console something like (when I pressed a button):

1. button1Clicked();
2.     calculating();
3.          printingResults();

Which basically means that button1Clicked() called calculating() which called printingResults()

Is there a utility, or plugin, browser, or maybe some way in the language to do this? I’m using google chrome, btw.

p.s and NO I do not want to go through each function and add a "console.log("inside function X")" b/c that’s too much work

p.p.s as an added bonus I’d like to see the arguments passed into the functions too, but maybe that’s pushing it. :>

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T10:39:59+00:00Added an answer on June 9, 2026 at 10:39 am

    I can’t think of a great way to intercept all function calls globally to insert logging (though there is a decent workaround in the update section below).

    Instead, how about only adding logging to functions in a certain namespace that you care about? You can do this with the following setup code:

    var functionLogger = {};
    
    functionLogger.log = true;//Set this to false to disable logging 
    
    /**
     * Gets a function that when called will log information about itself if logging is turned on.
     *
     * @param func The function to add logging to.
     * @param name The name of the function.
     *
     * @return A function that will perform logging and then call the function. 
     */
    functionLogger.getLoggableFunction = function(func, name) {
        return function() {
            if (functionLogger.log) {
                var logText = name + '(';
    
                for (var i = 0; i < arguments.length; i++) {
                    if (i > 0) {
                        logText += ', ';
                    }
                    logText += arguments[i];
                }
                logText += ');';
    
                console.log(logText);
            }
    
            return func.apply(this, arguments);
        }
    };
    
    /**
     * After this is called, all direct children of the provided namespace object that are 
     * functions will log their name as well as the values of the parameters passed in.
     *
     * @param namespaceObject The object whose child functions you'd like to add logging to.
     */
    functionLogger.addLoggingToNamespace = function(namespaceObject){
        for(var name in namespaceObject){
            var potentialFunction = namespaceObject[name];
    
            if(Object.prototype.toString.call(potentialFunction) === '[object Function]'){
                namespaceObject[name] = functionLogger.getLoggableFunction(potentialFunction, name);
            }
        }
    };
    

    Then, for whatever namespaceObject you want to add logging to, you just call:

    functionLogger.addLoggingToNamespace(yourNamespaceObject);
    

    Here’s a fiddle to see it in action.

    UPDATE
    Note that you can call functionLogger.addLoggingToNamespace(window); to add logging to all global functions at the time of the call. Also, if you really want, you can traverse the tree to find any functions and update them accordingly. The one downfall of this method is that it only works on functions that exist at the time. Thus, it’s still not the greatest solution, but it’s a LOT less work than adding logging statements by hand 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on ajax-page using PageMethods (web service) to interact with server. I
I'm trying to interact with an application over the network which uses a simple
I'd like to write myself a simple script that uses AJAX to load the
JavaScript can interact very well with the server also. Using Ajax we can send
I currently have a web based application which strictly relies on a 3rd party
I'm using jQuery's ajax methods to interact with the Twitter REST API . Their
Is it possible to interact with an XML file after making a $.ajax() call?
I'm creating a small Web-Application with PHP, JavaScript, Ajax and of course HTML and
I am trying to interact with a javascript api (bare in mind I have
Im attempting to interact with another company's web service via WSDL. I've imported it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.