Refactor and rename ConsoleObserver...

...Renamed to "ILogger", to designate that this is an Interface for a
Logger. This "Interface" is pure virtual, so that it cannot be
instantiated directly. This makes it clear that it is intended to be
derived.

Finally, got rid of all the individual log-style methods and replaced
with SendLog. The idea here is that day-to-day users will only interact
with ILogger through ConsoleSingleton (or, likely, LoggerSingleton in
the future). This singleton will manage an arbirtary collection of
ILogger, and call SendLog with the appropriate parameters based on what
the user requests.

Therefore, the singleton itself will have the individual Log, Message,
Error, etc... methods, while stil allowing us to simplify the code base
of ILogger and its derived classes.
This commit is contained in:
ezzieyguywuf
2019-09-10 00:27:36 -04:00
committed by wmayer
parent 7416055dbb
commit 9fcc18b08e
12 changed files with 392 additions and 417 deletions

View File

@@ -63,7 +63,7 @@ namespace Gui {
/** Displays all messages at startup inside the splash screen.
* \author Werner Mayer
*/
class SplashObserver : public Base::ConsoleObserver
class SplashObserver : public Base::ILogger
{
public:
SplashObserver(QSplashScreen* splasher=0)
@@ -110,28 +110,14 @@ public:
{
return "SplashObserver";
}
void Warning(const char * s)
void SendLog(const std::string& msg, Base::LogStyle level) override
{
(void) level; // to eliminate unused parameter warning
#ifdef FC_DEBUG
Log(s);
Log(msg.c_str());
#else
Q_UNUSED(s);
#endif
}
void Message(const char * s)
{
#ifdef FC_DEBUG
Log(s);
#else
Q_UNUSED(s);
#endif
}
void Error (const char * s)
{
#ifdef FC_DEBUG
Log(s);
#else
Q_UNUSED(s);
Q_UNUSED(msg.c_str());
#endif
}
void Log (const char * s)