Rev 779 | Rev 837 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 779 | Rev 780 | ||
---|---|---|---|
Line 122... | Line 122... | ||
122 | {
|
122 | {
|
123 | printf("simulating year %d ...\n", year-1); |
123 | printf("simulating year %d ...\n", year-1); |
124 | }
|
124 | }
|
125 | 125 | ||
126 | QMutex qdebug_mutex;
|
126 | QMutex qdebug_mutex;
|
127 | void myMessageOutput(QtMsgType type, const |
127 | void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg) |
128 | {
|
128 | {
|
129 | - | ||
- | 129 | Q_UNUSED(context); |
|
130 | QMutexLocker m(&qdebug_mutex); |
130 | QMutexLocker m(&qdebug_mutex); |
- | 131 | ||
131 | switch (type) { |
132 | switch (type) { |
132 | case QtDebugMsg: |
133 | case QtDebugMsg: |
133 | *ConsoleShell::logStream() << msg << endl; |
134 | *ConsoleShell::logStream() << msg << endl; |
134 | break; |
135 | break; |
135 | case QtWarningMsg: |
136 | case QtWarningMsg: |
Line 167... | Line 168... | ||
167 | qDebug() << "cannot open logfile" << fname; |
168 | qDebug() << "cannot open logfile" << fname; |
168 | } else { |
169 | } else { |
169 | qDebug() << "Log output is redirected to logfile" << fname; |
170 | qDebug() << "Log output is redirected to logfile" << fname; |
170 | mLogStream = new QTextStream(file); |
171 | mLogStream = new QTextStream(file); |
171 | }
|
172 | }
|
172 |
|
173 | qInstallMessageHandler(myMessageOutput); |
173 | 174 | ||
174 | 175 | ||
175 | }
|
176 | }
|
176 | 177 |