+ enum class LogLevel
+ {
+ Debug,
+ Info,
+ Warning,
+ Error,
+ Fatal
+ };
+
+ struct COMMON_EXPORT LogEntry
+ {
+ QDateTime timeStamp;
+ LogLevel logLevel;
+ QString message;
+
+ /**
+ * Gets this log entry in a printable format, with timestamp and log level
+ *
+ * @return the log entry, formatted with timestamp and log level
+ */
+ QString toString() const;
+ };
+
+ /**
+ * Initial setup, to be called ones command line options are available.
+ *
+ * Sets up the log file if appropriate. Outputs the log messages already accumulated since
+ * construction. If @c keepMessages is false, deletes the accumulated messages afterwards,
+ * and won't store further ones.
+ *
+ * @param keepMessages Whether messages should be kept
+ * @throws ExitException, if command line options are invalid
+ */
+ void setup(bool keepMessages);
+
+ /**
+ * Accesses the stores log messages, e.g. for consumption by DebugLogWidget.
+ *
+ * @returns The accumuates log messages
+ */
+ std::vector<Logger::LogEntry> messages() const;
+
+ static void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString& message);