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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user