Therefore, I want to use Boost.Log for all my logging purposes. Currently, I have written a class that covers all the necessary operations for creating instances and setting up helper methods.
The problem is that I want to overload the <operator to use it in cout mode. I want to be able to use it in order to have different types of arguments seems to be the biggest problem.
Here is what I tried:
template <typename T> void trace::operator <<(T data) { std::string text=boost::lexical_cast<std::string>(data); std::cout<<data<<std::endl; BOOST_LOG_TRIVIAL(debug) << text; }
However, I understand that this is a bit wrong logic in it. To be able to pass multiple arguments to <it must be recursive. But I'm a little confused how to do this with a buffer.
Do I need to define a logging system using a custom shell instead of a convenient boost macro? If so, does std :: ostream support return? I assume this will be the return value and the input value to the stream.
source share