MCPcopy Create free account
hub / github.com/chris2511/xca / myMessageOutput

Function myMessageOutput

lib/debug_info.cpp:119–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

117}
118
119static void myMessageOutput(QtMsgType type, const QMessageLogContext &ctx,
120 const QString &msg)
121{
122 static QElapsedTimer *t;
123 static int abort_on_warning = -1;
124 const char *severity = "Unknown", *warn_msg = NULL;
125 int el;
126
127 if (!t) {
128 t = new QElapsedTimer();
129 t->start();
130 }
131 if (abort_on_warning == -1) {
132 char *a = getenv("XCA_ABORT_ON_WARNING");
133 abort_on_warning = a && *a;
134 }
135 debug_info dinfo(ctx);
136 el = t->elapsed();
137 switch (type) {
138 case QtDebugMsg:
139 if (!dinfo.do_debug())
140 return;
141 severity = COL_CYAN "Debug";
142 break;
143 case QtWarningMsg: warn_msg = "WARNING"; severity = COL_LRED "Warning"; break;
144 case QtCriticalMsg: warn_msg = "CRITICAL"; severity = COL_RED "Critical"; break;
145 case QtFatalMsg: warn_msg = "FATAL"; severity = COL_RED "Fatal"; break;
146 case QtInfoMsg: severity = COL_CYAN "Info"; break;
147 default: severity = COL_CYAN "Default"; break;
148 }
149 console_write(stderr, QString(COL_YELL "%1%2 %3:%5" COL_RESET " %4\n")
150 .arg(el/1000, 4)
151 .arg((el%1000)/100, 2, 10, QChar('0'))
152 .arg(severity).arg(msg)
153 .arg(dinfo.log_prefix()).toUtf8());
154
155 if (abort_on_warning == 1 && warn_msg) {
156 qFatal("Abort on %s", warn_msg);
157 }
158}
159
160void debug_info::init()
161{

Callers

nothing calls this directly

Calls 5

console_writeFunction · 0.85
do_debugMethod · 0.80
log_prefixMethod · 0.80
QStringClass · 0.70
startMethod · 0.45

Tested by

no test coverage detected