FileLogger performance

…it only logs to the console, if no logger was set. So what I was about to do (just was not important enough), was to write:

class SwallowLogger : public Logger
{
    void logMessage (const String &message) override {}
};
Logger::setCurrentLogger (new SwallowLogger());

But actually I would wish for an additional int or bitmask to add a log level to the writeToLog() call:

void Logger::writeToLog (const String& message, int level=0)
{
    if (currentLogger && level >= currentLogger->getLogLevel()) {
        currentLogger->logMessage (message);
    }
}

just needs a get and set method for log level in the Logger base class, so it needs changes in the juce code.
I think there was already a request for that, once upon a time… found it:

1 Like