summaryrefslogtreecommitdiffstats
path: root/logic/MinecraftProcess.cpp
diff options
context:
space:
mode:
authorStiepen22 <stiepen22@gmx.de>2013-09-08 15:02:52 +0200
committerStiepen22 <stiepen22@gmx.de>2013-09-08 15:02:52 +0200
commitdab2bbe4e79cfd8b3b72b8d2fd0e5bd66e0281a9 (patch)
treefa72bb238a11e2f98cf6816c4a8540f2abb0efc9 /logic/MinecraftProcess.cpp
parent5cac21ca6387a3cbd5492b933c5ad6d7b76b8bc7 (diff)
downloadMultiMC-dab2bbe4e79cfd8b3b72b8d2fd0e5bd66e0281a9.tar
MultiMC-dab2bbe4e79cfd8b3b72b8d2fd0e5bd66e0281a9.tar.gz
MultiMC-dab2bbe4e79cfd8b3b72b8d2fd0e5bd66e0281a9.tar.lz
MultiMC-dab2bbe4e79cfd8b3b72b8d2fd0e5bd66e0281a9.tar.xz
MultiMC-dab2bbe4e79cfd8b3b72b8d2fd0e5bd66e0281a9.zip
Added console coloring and made the log not contain any usernames/session ids
Diffstat (limited to 'logic/MinecraftProcess.cpp')
-rw-r--r--logic/MinecraftProcess.cpp30
1 files changed, 21 insertions, 9 deletions
diff --git a/logic/MinecraftProcess.cpp b/logic/MinecraftProcess.cpp
index 6ac5b886..c33d34a8 100644
--- a/logic/MinecraftProcess.cpp
+++ b/logic/MinecraftProcess.cpp
@@ -84,17 +84,14 @@ void MinecraftProcess::on_stdErr()
for(int i = 0; i < lines.size() - 1; i++)
{
QString & line = lines[i];
- MessageLevel::Enum level = MessageLevel::Error;
- 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("[WARNING]") || line.contains("[STDERR]"))
- level = MessageLevel::Error;
- emit log(lines[i].toLocal8Bit(), level);
+ emit log(line.replace(username, "<Username>").replace(sessionID, "<Session ID>").toLocal8Bit(), getLevel(line, MessageLevel::Error));
}
if(!complete)
m_err_leftover = lines.last();
}
+
+
void MinecraftProcess::on_stdOut()
{
QByteArray data = readAllStandardOutput();
@@ -106,7 +103,7 @@ void MinecraftProcess::on_stdOut()
for(int i = 0; i < lines.size() - 1; i++)
{
QString & line = lines[i];
- emit log(lines[i].toLocal8Bit(), MessageLevel::Message);
+ emit log(line.replace(username, "<Username>").replace(sessionID, "<Session ID>").toLocal8Bit(), getLevel(line, MessageLevel::Message));
}
if(!complete)
m_out_leftover = lines.last();
@@ -167,7 +164,7 @@ void MinecraftProcess::launch()
emit log(QString("Minecraft folder is: '%1'").arg(workingDirectory()));
QString JavaPath = m_instance->settings().get("JavaPath").toString();
emit log(QString("Java path: '%1'").arg(JavaPath));
- emit log(QString("Arguments: '%1'").arg(m_args.join("' '")));
+ emit log(QString("Arguments: '%1'").arg(m_args.join("' '").replace(username, "<Username>").replace(sessionID, "<Session ID>")));
start(JavaPath, m_args);
if (!waitForStarted())
{
@@ -177,4 +174,19 @@ void MinecraftProcess::launch()
}
}
-
+MessageLevel::Enum MinecraftProcess::getLevel(const QString &line, MessageLevel::Enum level)
+{
+
+ 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("Exception in thread") || line.contains(" at "))
+ level = MessageLevel::Fatal;
+ if(line.contains("[DEBUG]"))
+ level = MessageLevel::Debug;
+ return level;
+
+} \ No newline at end of file