diff options
author | Petr Mrázek <peterix@gmail.com> | 2015-07-22 09:01:04 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2015-07-22 09:01:04 +0200 |
commit | 6310f6569c2630f27ad72dc0a5fef9f9fec5a88c (patch) | |
tree | 472be93fc6d94d38e0830d87186eee25c01dcb9c /logic/launch | |
parent | 2fc18921b04536285ad82e49d61faaeb599c6d46 (diff) | |
download | MultiMC-6310f6569c2630f27ad72dc0a5fef9f9fec5a88c.tar MultiMC-6310f6569c2630f27ad72dc0a5fef9f9fec5a88c.tar.gz MultiMC-6310f6569c2630f27ad72dc0a5fef9f9fec5a88c.tar.lz MultiMC-6310f6569c2630f27ad72dc0a5fef9f9fec5a88c.tar.xz MultiMC-6310f6569c2630f27ad72dc0a5fef9f9fec5a88c.zip |
GH-1053 move guessLevel to instances
Diffstat (limited to 'logic/launch')
-rw-r--r-- | logic/launch/LaunchTask.cpp | 43 | ||||
-rw-r--r-- | logic/launch/LaunchTask.h | 17 | ||||
-rw-r--r-- | logic/launch/steps/CheckJava.cpp | 1 |
3 files changed, 3 insertions, 58 deletions
diff --git a/logic/launch/LaunchTask.cpp b/logic/launch/LaunchTask.cpp index 248761f0..66502020 100644 --- a/logic/launch/LaunchTask.cpp +++ b/logic/launch/LaunchTask.cpp @@ -119,47 +119,6 @@ QString LaunchTask::censorPrivateInfo(QString in) return in; } -// console window -MessageLevel::Enum LaunchTask::guessLevel(const QString &line, MessageLevel::Enum level) -{ - QRegularExpression re("\\[(?<timestamp>[0-9:]+)\\] \\[[^/]+/(?<level>[^\\]]+)\\]"); - auto match = re.match(line); - if(match.hasMatch()) - { - // New style logs from log4j - QString timestamp = match.captured("timestamp"); - QString levelStr = match.captured("level"); - if(levelStr == "INFO") - level = MessageLevel::Message; - if(levelStr == "WARN") - level = MessageLevel::Warning; - if(levelStr == "ERROR") - level = MessageLevel::Error; - if(levelStr == "FATAL") - level = MessageLevel::Fatal; - if(levelStr == "TRACE" || levelStr == "DEBUG") - level = MessageLevel::Debug; - } - else - { - // Old style forge logs - if (line.contains("[INFO]") || line.contains("[CONFIG]") || line.contains("[FINE]") || - line.contains("[FINER]") || line.contains("[FINEST]")) - level = MessageLevel::Message; - if (line.contains("[SEVERE]") || line.contains("[STDERR]")) - level = MessageLevel::Error; - if (line.contains("[WARNING]")) - level = MessageLevel::Warning; - if (line.contains("[DEBUG]")) - level = MessageLevel::Debug; - } - if (line.contains("overwriting existing")) - return MessageLevel::Fatal; - if (line.contains("Exception in thread") || line.contains(QRegularExpression("\\s+at "))) - return MessageLevel::Error; - return level; -} - void LaunchTask::proceed() { if(state != LaunchTask::Waiting) @@ -223,7 +182,7 @@ void LaunchTask::onLogLine(QString line, MessageLevel::Enum level) // If the level is still undetermined, guess level if (level == MessageLevel::StdErr || level == MessageLevel::StdOut || level == MessageLevel::Unknown) { - level = this->guessLevel(line, level); + level = m_instance->guessLevel(line, level); } // censor private user info diff --git a/logic/launch/LaunchTask.h b/logic/launch/LaunchTask.h index 75dc1d35..24139ea8 100644 --- a/logic/launch/LaunchTask.h +++ b/logic/launch/LaunchTask.h @@ -21,18 +21,7 @@ #include "MessageLevel.h" #include "LoggedProcess.h" #include "LaunchStep.h" -/* HACK: MINECRAFT: split! */ -#include "minecraft/MinecraftInstance.h" -#include "java/JavaChecker.h" -#include "QObjectPtr.h" -#include "tasks/Task.h" -class ProcessTask -{ - -}; - -class BaseProfilerFactory; class LaunchTask: public Task { Q_OBJECT @@ -89,13 +78,9 @@ public: /* methods */ */ virtual bool abort() override; - - -public: /* HACK: remove this from here! */ - +public: QString substituteVariables(const QString &cmd) const; QString censorPrivateInfo(QString in); - virtual MessageLevel::Enum guessLevel(const QString &message, MessageLevel::Enum defaultLevel); protected: /* methods */ virtual void emitFailed(QString reason); diff --git a/logic/launch/steps/CheckJava.cpp b/logic/launch/steps/CheckJava.cpp index bd4c4856..22f62057 100644 --- a/logic/launch/steps/CheckJava.cpp +++ b/logic/launch/steps/CheckJava.cpp @@ -16,6 +16,7 @@ #include "CheckJava.h" #include <launch/LaunchTask.h> #include <QStandardPaths> +#include <QFileInfo> void CheckJava::executeTask() { |