Does node.js have anything like __file__ and __line__ like the c++ preprocessor macros?

后端 未结 4 695
日久生厌
日久生厌 2021-01-11 15:35

I\'m working on enhancing logging in some node.js applications. In the past have used C++\'s __ file__ and __ line __ preprocessor macros to help us track down issues when

4条回答
  •  孤城傲影
    2021-01-11 16:19

    see the global object:

    __filename 
    

    for the lineNumber see this post: javascript node.js getting line number in try catch?

提交回复
热议问题