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

  • Home
  • SEARCH
  • 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 8727329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:25:00+00:00 2026-06-13T08:25:00+00:00

In Node.js, I’m trying to get the line number of each function that is

  • 0

In Node.js, I’m trying to get the line number of each function that is called in a script. Is there any way to generate a summary of each function that is called in a script? I’d like to get a list of line numbers that are called by each function in the script, so that I can comment out one of the function calls (which I’m still trying to find.)

An example:

function printStuff(){
    console.log("This is an example.");
}
printStuff();
printStuff();

Now I’d like to get a summary of all the events in this script (without modifying the script). It might look something like this:

calling printStuff at line 4
calling console.log at line 2
calling printStuff at line 5
calling console.log at line 2

Are there any testing/debugging tools that make it possible to do this?

  • 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-13T08:25:02+00:00Added an answer on June 13, 2026 at 8:25 am

    Not EXACTLY what you are looking for, I guess, but you should be able to modify it to your needs:

    Object.defineProperty(global, '__stack', {
      get: function(){
        var orig = Error.prepareStackTrace;
        Error.prepareStackTrace = function(_, stack){ return stack; };
        var err = new Error;
        Error.captureStackTrace(err, arguments.callee);
        var stack = err.stack;
        Error.prepareStackTrace = orig;
        return stack;
      }
    });
    
    Object.defineProperty(global, '__line', {
      get: function(){
        return __stack[1].getLineNumber();
      }
    });
    
    console.log("I am running from line " + __line);
    

    It was discussed here

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

Sidebar

Related Questions

In Node.js is there any way to listen to all events emitted by an
node version is 0.6.17. I was trying to get the number of bytes of
4 node Binary Search tree: 2143. there are 3 ways to insert and get
Since Node is asynchronous, I'm having problems trying to get a callback to return
Node.js: Should package.json dependencies be managed manually only or there is some tools that
Each node of the tree might have an arbitrary number of children. I need
Any node can have any number of children. To search this tree i wrote
In node.js calling console.log on an object that has an element called inspect prints
in node.js, is there any shortcut to export ALL functions in a given file?
With Node I am trying to collect user data from an LDAP server and

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.