@@ -86,6 +86,51 @@ namespace webdriver {
8686
8787namespace {
8888
89+ #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
90+ void silentMessageOutput (QtMsgType type, const QMessageLogContext &context, const QString &msg)
91+ {
92+ // keep silence
93+ return ;
94+ }
95+
96+ void normalMessageOutput (QtMsgType type, const QMessageLogContext &context, const QString &msg)
97+ {
98+ QByteArray localMsg = msg.toLocal8Bit ();
99+ switch (type) {
100+ case QtDebugMsg:
101+ // keep silence
102+ break ;
103+ case QtWarningMsg:
104+ fprintf (stderr, " Warning: %s (%s:%u, %s)\n " , localMsg.constData (), context.file , context.line , context.function );
105+ break ;
106+ case QtCriticalMsg:
107+ fprintf (stderr, " Critical: %s (%s:%u, %s)\n " , localMsg.constData (), context.file , context.line , context.function );
108+ break ;
109+ case QtFatalMsg:
110+ fprintf (stderr, " Fatal: %s (%s:%u, %s)\n " , localMsg.constData (), context.file , context.line , context.function );
111+ abort ();
112+ }
113+ }
114+
115+ void verboseMessageOutput (QtMsgType type, const QMessageLogContext &context, const QString &msg)
116+ {
117+ QByteArray localMsg = msg.toLocal8Bit ();
118+ switch (type) {
119+ case QtDebugMsg:
120+ fprintf (stderr, " Debug: %s (%s:%u, %s)\n " , localMsg.constData (), context.file , context.line , context.function );
121+ break ;
122+ case QtWarningMsg:
123+ fprintf (stderr, " Warning: %s (%s:%u, %s)\n " , localMsg.constData (), context.file , context.line , context.function );
124+ break ;
125+ case QtCriticalMsg:
126+ fprintf (stderr, " Critical: %s (%s:%u, %s)\n " , localMsg.constData (), context.file , context.line , context.function );
127+ break ;
128+ case QtFatalMsg:
129+ fprintf (stderr, " Fatal: %s (%s:%u, %s)\n " , localMsg.constData (), context.file , context.line , context.function );
130+ abort ();
131+ }
132+ }
133+ #else
89134void silentMessageOutput (QtMsgType type, const char *msg)
90135{
91136 // keep silence
@@ -127,6 +172,7 @@ void verboseMessageOutput(QtMsgType type, const char *msg)
127172 abort ();
128173 }
129174}
175+ #endif
130176
131177void InitCallbacks (Dispatcher* dispatcher,
132178 base::WaitableEvent* shutdown_event,
0 commit comments