Logs showing up in release mode

I was surprised to see my logs showing up in release mode both in Windows and Mac.

In windows it uses

OutputDebugString ((text + "\n").toWideCharPointer());

And in Mac:

std::cerr << text << std::endl;

I run a short search in Stackoverflow and found one way to tackle this (Windows):

#ifdef _DEBUG
    #define LOGMESSAGE( str ) OutputDebugString( str );
#else
    #define LOGMESSAGE( str )
#endif

Eh?

It depends what you’re using to write to the log… If you use the DBG macro, then it’s disabled in release mode.

oh, thanks Jules.

I’ll replace the calls to DBG.

Wouldn’t it also be better to change WriteToLog() to use DBG?

void Logger::writeToLog (const String& message)
{
    if (currentLogger != nullptr)
        currentLogger->logMessage (message);
    else
        outputDebugString (message);
}

No. If it was supposed to work like that, I’d have called it “writeToLogExceptInReleaseMode”.

Most of my bugs are in my Release build. They disappear in the Debug verison :frowning:

Most of my bugs are in my Release build. They disappear in the Debug verison :-([/quote]

That sounds familiar. Many of mine only activate when they leave my office.