1 #include <QtCore/QCoreApplication>
6 void messageHandler(QtMsgType type, const char *msg)
10 static const QString LOGFILE_PATH = "/tmp/buliscores.log";
11 static const QtMsgType LOGLEVEL = QtDebugMsg;
14 if (type < LOGLEVEL) {
18 if (logfile.isOpen() == false) {
19 logfile.setFileName(LOGFILE_PATH);
20 if (logfile.open(QIODevice::Append) == true) {
21 fw.setDevice((QIODevice*)&logfile);
22 fw << "Logfile Opened: " << QDateTime::currentDateTime().toString();
28 out = "%1 Debug: %2\n";
31 out = "%1 Warning: %2\n";
34 out = "%1 Critical: %2\n";
37 out = "%1 Fatal: %2\n";
41 out = out.arg(QDateTime::currentDateTime().toString(), msg);
43 if (logfile.isOpen()) {
47 printf("%s", out.toAscii().constData());
49 if (type == QtFatalMsg) {
54 int main(int argc, char *argv[])
56 QCoreApplication a(argc, argv);