FileLogger performance

FileLogger in debug build inserts a DBG statement printing everything to the console. That’s pretty annoying :wink: A lot of logging to the console makes things go pretty slow, and makes it hard to spot other more important DBG message.

I’m going to just use my own FileLogger for now but I wonder if it really needs to be there?

…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