A better LOG() macro using template metaprogramming

后端 未结 2 1053
臣服心动
臣服心动 2021-01-30 03:16

A typical LOG() macro-based logging solution may look something like this:

#define LOG(msg) \\
    std::cout << __FILE__ << \"(\" << __LINE__ &         


        
2条回答
  •  感情败类
    2021-01-30 03:56

    I've gone through exactly the same thing. And I ended up with the same solution you've outlined, which just requires the client API to use comma instead of the insertion operator. It keeps things fairly simple, and works well enough. Highly recommended.

提交回复
热议问题