mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-20 19:45:20 +00:00
Add option to log qDebug
This commit is contained in:
parent
ef9638e094
commit
088931525d
1 changed files with 22 additions and 0 deletions
|
@ -56,6 +56,7 @@ extern char **environ;
|
|||
#endif
|
||||
|
||||
LOG_CHANNEL(sys_log, "SYS");
|
||||
LOG_CHANNEL(q_debug, "QDEBUG");
|
||||
|
||||
[[noreturn]] extern void report_fatal_error(const std::string& text)
|
||||
{
|
||||
|
@ -172,6 +173,7 @@ const char* arg_styles = "styles";
|
|||
const char* arg_style = "style";
|
||||
const char* arg_stylesheet = "stylesheet";
|
||||
const char* arg_config = "config";
|
||||
const char* arg_q_debug = "qDebug";
|
||||
const char* arg_error = "error";
|
||||
const char* arg_updating = "updating";
|
||||
|
||||
|
@ -269,6 +271,20 @@ QCoreApplication* createApplication(int& argc, char* argv[])
|
|||
return new gui_application(argc, argv);
|
||||
}
|
||||
|
||||
void log_q_debug(QtMsgType type, const QMessageLogContext& context, const QString& msg)
|
||||
{
|
||||
Q_UNUSED(context);
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case QtDebugMsg: q_debug.trace("%s", msg.toStdString()); break;
|
||||
case QtInfoMsg: q_debug.notice("%s", msg.toStdString()); break;
|
||||
case QtWarningMsg: q_debug.warning("%s", msg.toStdString()); break;
|
||||
case QtCriticalMsg: q_debug.error("%s", msg.toStdString()); break;
|
||||
case QtFatalMsg: q_debug.fatal("%s", msg.toStdString()); break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main(int argc, char** argv)
|
||||
|
@ -430,6 +446,7 @@ int main(int argc, char** argv)
|
|||
parser.addOption(QCommandLineOption(arg_stylesheet, "Loads a custom stylesheet.", "path", ""));
|
||||
const QCommandLineOption config_option(arg_config, "Forces the emulator to use this configuration file.", "path", "");
|
||||
parser.addOption(config_option);
|
||||
parser.addOption(QCommandLineOption(arg_q_debug, "Log qDebug to RPCS3.log."));
|
||||
parser.addOption(QCommandLineOption(arg_error, "For internal usage."));
|
||||
parser.addOption(QCommandLineOption(arg_updating, "For internal usage."));
|
||||
parser.process(app->arguments());
|
||||
|
@ -438,6 +455,11 @@ int main(int argc, char** argv)
|
|||
if (parser.isSet(version_option) || parser.isSet(help_option))
|
||||
return 0;
|
||||
|
||||
if (parser.isSet(arg_q_debug))
|
||||
{
|
||||
qInstallMessageHandler(log_q_debug);
|
||||
}
|
||||
|
||||
if (parser.isSet(arg_styles))
|
||||
{
|
||||
#ifdef _WIN32
|
||||
|
|
Loading…
Add table
Reference in a new issue