# FileLogger performance

**URL:** <https://forum.juce.com/t/filelogger-performance/20149>\
**Category:** General JUCE discussion\
**Created:** [December 5, 2016, 2:03pm UTC](https://forum.juce.com/t/filelogger-performance/20149 "2016-12-05T14:03:33Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![daniel](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/daniel/32/790_2.png) [@daniel](https://forum.juce.com/u/daniel)\
**Post date:** [December 5, 2016, 2:23pm UTC](https://forum.juce.com/t/filelogger-performance/20149/2 "2016-12-05T14:23:52Z")

</div>

…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:

> [@Log levels](https://forum.juce.com/t/log-levels/6232/3):
>
> I’d guess OP is talking levels like TRACE/DEBUG/INFO/WARN/ERROR as in log4… type of logging packages.

---

_[View the full topic](https://forum.juce.com/t/filelogger-performance/20149)._
