summaryrefslogtreecommitdiffstats
path: root/libmultimc/src/minecraftprocess.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2013-03-26 14:34:34 +0100
committerPetr Mrázek <peterix@gmail.com>2013-03-26 14:34:34 +0100
commitd24c4823ef8e144a3ffefc208c5a15e86b0b31b1 (patch)
treed177b5dd2ce576f3d708acf17b73873bf3502e94 /libmultimc/src/minecraftprocess.cpp
parentd2eef6974be6c9d65f0108bb86fc94e141330c76 (diff)
downloadMultiMC-d24c4823ef8e144a3ffefc208c5a15e86b0b31b1.tar
MultiMC-d24c4823ef8e144a3ffefc208c5a15e86b0b31b1.tar.gz
MultiMC-d24c4823ef8e144a3ffefc208c5a15e86b0b31b1.tar.lz
MultiMC-d24c4823ef8e144a3ffefc208c5a15e86b0b31b1.tar.xz
MultiMC-d24c4823ef8e144a3ffefc208c5a15e86b0b31b1.zip
Filter console output, no more sea of red when there's nothing to report.
Diffstat (limited to 'libmultimc/src/minecraftprocess.cpp')
-rw-r--r--libmultimc/src/minecraftprocess.cpp33
1 files changed, 31 insertions, 2 deletions
diff --git a/libmultimc/src/minecraftprocess.cpp b/libmultimc/src/minecraftprocess.cpp
index 1239bc3a..f1b63e3d 100644
--- a/libmultimc/src/minecraftprocess.cpp
+++ b/libmultimc/src/minecraftprocess.cpp
@@ -125,12 +125,41 @@ MinecraftProcess::MinecraftProcess(InstancePtr inst, QString user, QString sessi
// console window
void MinecraftProcess::on_stdErr()
{
- emit log(readAllStandardError(), MessageLevel::Error);
+ QByteArray data = readAllStandardError();
+ QString str = m_err_leftover + QString::fromLocal8Bit(data);
+ m_err_leftover.clear();
+ QStringList lines = str.split("\n");
+ bool complete = str.endsWith("\n");
+
+ 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);
+ }
+ if(!complete)
+ m_err_leftover = lines.last();
}
void MinecraftProcess::on_stdOut()
{
- emit log(readAllStandardOutput(), MessageLevel::Message);
+ QByteArray data = readAllStandardOutput();
+ QString str = m_out_leftover + QString::fromLocal8Bit(data);
+ m_out_leftover.clear();
+ QStringList lines = str.split("\n");
+ bool complete = str.endsWith("\n");
+
+ for(int i = 0; i < lines.size() - 1; i++)
+ {
+ QString & line = lines[i];
+ emit log(lines[i].toLocal8Bit(), MessageLevel::Message);
+ }
+ if(!complete)
+ m_out_leftover = lines.last();
}
// exit handler