beginner here
I am trying to make a "logger" for my c++ learning project, I´ve already set up code to manage the logging itself, but I can´t get the function to work from other classes.
Here´s my "Debugger" class
class MSEdebug
{
MSEdebug(){logOutput.open("log.txt");}
~MSEdebug() { logOutput.close(); }
void debuglog(std::string info)
{
#ifdef DEBUG
std::cout << "LOG:" << info << std::endl;
#endif // DEBUG
logOutput << "LOG:" << info << "\n";
}
std::ofstream logOutput;
};
And here´s what I want to be able to do:
#include "MSE_debug.h"
//...
MSEapp::debugTest()
{
MSEdebug::debuglog("Test, 1, 2, 3...");
}
Now this doesn´t work, and you experienced C++ programmers are probably rolling your eyes already, but could you be so kind to tell me how I would get it to work.
Btw, I hope I´ve done this correctly, this is my first question, so I´m sorry if it´s bad