Select Git revision
ConsoleLogging.cpp
-
Oliver Bock authored
git-svn-id: https://svn.origo.ethz.ch/fidelity@3 53d1999f-d1a8-4366-aa61-588fded17473
Oliver Bock authoredgit-svn-id: https://svn.origo.ethz.ch/fidelity@3 53d1999f-d1a8-4366-aa61-588fded17473
ConsoleLogging.cpp 2.07 KiB
/*************************************************************************
* Copyright (C) 2007 by Oliver Bock *
* bock@tfh-berlin.de *
* *
* This file is part of Fidelity. *
* *
* Fidelity is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published *
* by the Free Software Foundation, version 3 of the License. *
* *
* Fidelity is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with Fidelity. If not, see <http://www.gnu.org/licenses/>. *
* *
*************************************************************************/
#include "ConsoleLogging.h"
Fidelity::Common::ConsoleLogging::ConsoleLogging() : ALoggingFacility()
{
initAttributes();
}
Fidelity::Common::ConsoleLogging::~ConsoleLogging()
{}
void Fidelity::Common::ConsoleLogging::initAttributes()
{
qInstallMsgHandler(messageHandler);
}
void Fidelity::Common::ConsoleLogging::messageHandler(QtMsgType type, const char * msg)
{
switch (type) {
case QtDebugMsg:
fprintf(stderr, "Debug: %s\n", msg);
break;
case QtWarningMsg:
fprintf(stderr, "Warning: %s\n", msg);
break;
case QtCriticalMsg:
fprintf(stderr, "Critical: %s\n", msg);
break;
case QtFatalMsg:
fprintf(stderr, "Fatal: %s (aborting)\n", msg);
abort();
}
}