C++ Logging Library Setup

后端 未结 4 1128
猫巷女王i
猫巷女王i 2021-02-15 14:24

I\'ve been trying for about 2 weeks now to get a logging library to work with. I\'ve tried Log4cxx, Log4cpp, log4cplus and boost.log. The problem isn\'t that none of these wor

4条回答
  •  悲哀的现实
    2021-02-15 15:13

    I'd recommend Pantheios. It takes some time to build everything when you first download - type make build test and go have lunch - and you have to select the output streams (Pantheios calls them "back ends") at link time, but for coding, it is really simple, e.g.

    std::string name;
    int age;
    
    pantheios::log_DEBUG("name=", name, " age=", pantheios::integer(age));
    

    It's designed from the ground up for speed - the age won't be converted into a string unless the "DEBUG" level is switched on - and robustness - which is why you can't pass fundamental types directly, and use "inserters" (e.g. pantheios::integer). See this recent blog post by Pantheios' author for more information.

提交回复
热议问题