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

后端 未结 4 694
日久生厌
日久生厌 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:24

    Expanded on the previous answers a bit into here: https://gist.github.com/gavinengel/8572856

    Allows setting globals: __line, __file, __ext, __dir

    By the way, how do I create?: __function, __method, __class

提交回复
热议问题