I need very simple logger to my application. But sometimes I don't want to use this logger to speed up my application.
My logger looks like:
class Logger
{
    public:
        Logger(bool isActive = true)
        {
            mIsActive = isActive;
            if (isActive)
            {
                out.open(pathToLogFile);
            }
        }
        static std::ofstream& log()
        {
            return out;
        }
    private:
        static bool mIsActive;
        static std::ofstream out;
};
In my application I use it as:
Logger(true);  // in one place
Logger::log() << "Log" << std::endl;
What if I don't want to use this logger?
Logger(false);  // in one place. it doesn't open any file.
Logger::log() << "Log" << std::endl; // it shouldn't write anywhere
What is behavior of << operator if I haven't opened file? Is it safe? Is it very fast? Is it good idea??
 
     
     
     
    