I tried to make a custom logger class, with which i then can log information and controll a log-level. But sadly I don't seem to get the setOut, setWarning and setError methods working.
To test things I made a pretty easy logging class, which inherits from std::ostream (because the above mentioned methods expect a std::ostream argument) and overrides the << operator:
#include <ostream>
#include <iostream>
class Logger: public std::ostream
{
    template<typename T>
    friend Logger& operator<<(Logger& logger, const T& t)
    {
        std::cout << "[Log]: " << t;
        return logger;
    }
};
Then I set the test-logging class with:
// a lot of setup, which can be summed up with the following three lines:
IloEnv env;
IloModel model(env);
IloCplex cp(model);
logger::Logger log;
cp.setOut(log);
When I run the code no output is done at all. When removing the cp.setOut(log) code and replacing it with env.setOut(log); the normal information are printed, but without the addional [Log]: :
Version identifier: 20.1.0.0 | 2020-11-10 | 9bedb6d68
Tried aggregator 1 time.
No LP presolve or aggregator reductions.
Presolve time = 0.00 sec. (0.56 ticks)
Initializing dual steep norms . . .
Iteration log . . .
Iteration:     1   Dual objective     =             0.000000
Iteration:    62   Dual objective     =             0.740539
What am I doing wrong and why isn't my code logged, as I would expect?
Edit:
I just noticed, that when setting the cplex out stream to std::cout (cp.setOut(std::cout)) everything workes flawlessly.
