[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [plasmate/terietor/konsolepreviewer] /: Filter the output
From:       Giorgos Tsiapaliokas <terietor () gmail ! com>
Date:       2012-08-08 17:28:48
Message-ID: 20120808172848.0B432A6094 () git ! kde ! org
[Download RAW message or body]

Git commit 3151c6931cad0ee80790129f937ea11170b4cdbd by Giorgos Tsiapaliokas.
Committed on 08/08/2012 at 17:40.
Pushed by tsiapaliwkas into branch 'terietor/konsolepreviewer'.

Filter the output

M  +28   -19   main.cpp

http://commits.kde.org/plasmate/3151c6931cad0ee80790129f937ea11170b4cdbd

diff --git a/main.cpp b/main.cpp
index e986417..b5edb17 100644
--- a/main.cpp
+++ b/main.cpp
@@ -29,26 +29,35 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 void customMessageHandler(QtMsgType type, const char *msg)
 {
-    QString txt;
-    switch (type) {
-        case QtDebugMsg:
-            txt = QString("Debug: %1").arg(msg);
-            break;
-        case QtWarningMsg:
-            txt = QString("Warning: %1").arg(msg);
-            break;
-        case QtCriticalMsg:
-            txt = QString("Critical: %1").arg(msg);
-            break;
-        case QtFatalMsg:
-            txt = QString("Fatal: %1").arg(msg);
-            abort();
+    if (QString(msg).startsWith("plasmate") || //don't include the plasmate specific output
+        QString(msg).startsWith("Object::") || // don't include QObject warnings
+        QString(msg).startsWith("QGraphicsScene::") || //don't include QGraphicsScene warnings
+        QString(msg).startsWith(" X Error")) //don't include silly X errors
+    {
+        std::cout << msg << std::endl;
+    } else {
+        QString txt;
+        switch (type) {
+            case QtDebugMsg:
+                txt = QString("Debug: %1").arg(msg);
+                break;
+            case QtWarningMsg:
+                txt = QString("Warning: %1").arg(msg);
+                break;
+            case QtCriticalMsg:
+                txt = QString("Critical: %1").arg(msg);
+                break;
+            case QtFatalMsg:
+                txt = QString("Fatal: %1").arg(msg);
+                abort();
+        }
+
+        QFile outFile("/var/tmp/plasmatepreviewerlog.txt");
+
+        outFile.open(QIODevice::WriteOnly | QIODevice::Append);
+        QTextStream ts(&outFile);
+        ts << txt << endl;
     }
-    QFile outFile("/var/tmp/plasmatepreviewerlog.txt");
-    outFile.open(QIODevice::WriteOnly | QIODevice::Append);
-    QTextStream ts(&outFile);
-    ts << txt << endl;
-    std::cout << txt.toLocal8Bit().constData() << std::endl;
 }
 
 int main(int argc, char *argv[])

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic