ofBaseLoggerChannel subclass for logging to the console and a file


#1

I created a simple ofBaseLoggerChannel sub-class for logging to both the console and a file. It also supports setting different minimum log levels for each:

Use it like this:

In ofApp.h:

std::shared_ptr<ofConsoleFileLoggerChannel> logger_;

In ofApp.cpp:

logger_ = std::make_shared<ofConsoleFileLoggerChannel>("log.txt", true);
ofSetLoggerChannel(logger_);

Hope it’s useful to someone!