void dumpLogging() { QString output = "Current Logging Categories:"; output += "\n\t logging: " + QString::number(logLogging().isDebugEnabled()); output += "\n\t keybinds: " + QString::number(logKeybinds().isDebugEnabled()); output += "\n\t settings: " + QString::number(logSettings().isDebugEnabled()); output += "\n\t gui: " + QString::number(logGUI().isDebugEnabled()); output += "\n\t teams: " + QString::number(logTeams().isDebugEnabled()); output += "\n\t db: " + QString::number(logDB().isDebugEnabled()); output += "\n\t input: " + QString::number(logInput().isDebugEnabled()); output += "\n\t position: " + QString::number(logPosition().isDebugEnabled()); output += "\n\t orientation: " + QString::number(logOrientation().isDebugEnabled()); output += "\n\t movement: " + QString::number(logMovement().isDebugEnabled()); output += "\n\t chat: " + QString::number(logChat().isDebugEnabled()); output += "\n\t infomsg: " + QString::number(logInfoMsg().isDebugEnabled()); output += "\n\t emotes: " + QString::number(logEmotes().isDebugEnabled()); output += "\n\t target: " + QString::number(logTarget().isDebugEnabled()); output += "\n\t spawn: " + QString::number(logSpawn().isDebugEnabled()); output += "\n\t mapevents: " + QString::number(logMapEvents().isDebugEnabled()); output += "\n\t slashcommand: " + QString::number(logSlashCommand().isDebugEnabled()); output += "\n\t description: " + QString::number(logDescription().isDebugEnabled()); output += "\n\t friends: " + QString::number(logFriends().isDebugEnabled()); output += "\n\t minimap: " + QString::number(logMiniMap().isDebugEnabled()); output += "\n\t lfg: " + QString::number(logLFG().isDebugEnabled()); output += "\n\t npcs: " + QString::number(logNPCs().isDebugEnabled()); output += "\n\t animations: " + QString::number(logAnimations().isDebugEnabled()); output += "\n\t powers: " + QString::number(logPowers().isDebugEnabled()); output += "\n\t trades: " + QString::number(logTrades().isDebugEnabled()); output += "\n\t scenegraph: " + QString::number(logSceneGraph().isDebugEnabled()); qDebug().noquote() << output; }
//++ ------------------------------------------------------------------------------------ // Details: Interpret the text data and match against current commands to see if there // is a match. If a match then the command is issued and actioned on. If a // command cannot be found to match then vwbCmdYesValid is set to false and // nothing else is done here. // This function is used by the application's main thread. // Type: Method. // Args: vTextLine - (R) Text data representing a possible command. // vwbCmdYesValid - (W) True = Command valid, false = command not handled. // Return: MIstatus::success - Functional succeeded. // MIstatus::failure - Functional failed. // Throws: None. //-- bool CMIDriver::InterpretCommandThisDriver(const CMIUtilString &vTextLine, bool &vwbCmdYesValid) { // Convert any CLI commands into MI commands const CMIUtilString vMITextLine(WrapCLICommandIntoMICommand(vTextLine)); vwbCmdYesValid = false; bool bCmdNotInCmdFactor = false; SMICmdData cmdData; CMICmdMgr &rCmdMgr = CMICmdMgr::Instance(); if (!rCmdMgr.CmdInterpret(vMITextLine, vwbCmdYesValid, bCmdNotInCmdFactor, cmdData)) return MIstatus::failure; if (vwbCmdYesValid) { // For debugging only // m_pLog->WriteLog( cmdData.strMiCmdAll.c_str() ); return ExecuteCommand(cmdData); } // Check for escape character, may be cursor control characters // This code is not necessary for application operation, just want to keep tabs on what // has been given to the driver to try and interpret. if (vMITextLine.at(0) == 27) { CMIUtilString logInput(MIRSRC(IDS_STDIN_INPUT_CTRL_CHARS)); for (MIuint i = 0; i < vMITextLine.length(); i++) { logInput += CMIUtilString::Format("%d ", vMITextLine.at(i)); } m_pLog->WriteLog(logInput); return MIstatus::success; } // Write to the Log that a 'command' was not valid. // Report back to the MI client via MI result record. CMIUtilString strNotInCmdFactory; if (bCmdNotInCmdFactor) strNotInCmdFactory = CMIUtilString::Format(MIRSRC(IDS_DRIVER_CMD_NOT_IN_FACTORY), cmdData.strMiCmd.c_str()); const CMIUtilString strNot(CMIUtilString::Format("%s ", MIRSRC(IDS_WORD_NOT))); const CMIUtilString msg( CMIUtilString::Format(MIRSRC(IDS_DRIVER_CMD_RECEIVED), vMITextLine.c_str(), strNot.c_str(), strNotInCmdFactory.c_str())); const CMICmnMIValueConst vconst = CMICmnMIValueConst(msg); const CMICmnMIValueResult valueResult("msg", vconst); const CMICmnMIResultRecord miResultRecord(cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error, valueResult); const bool bOk = m_rStdOut.WriteMIResponse(miResultRecord.GetString()); // Proceed to wait for or execute next command return bOk; }
void log_sink(unsigned long trace_level, char *trace_info, unsigned int len) { std::string logInput(trace_info, len); test_level = trace_level; test_log = logInput; ++test_count; }
void toggleLogging(QString &category) { if(category.isEmpty()) return; QLoggingCategory *cat = nullptr; if(category.contains("logging",Qt::CaseInsensitive)) cat = &logLogging(); else if(category.contains("keybinds",Qt::CaseInsensitive)) cat = &logKeybinds(); else if(category.contains("settings",Qt::CaseInsensitive)) cat = &logSettings(); else if(category.contains("gui",Qt::CaseInsensitive)) cat = &logGUI(); else if(category.contains("teams",Qt::CaseInsensitive)) cat = &logTeams(); else if(category.contains("db",Qt::CaseInsensitive)) cat = &logDB(); else if(category.contains("input",Qt::CaseInsensitive)) cat = &logInput(); else if(category.contains("position",Qt::CaseInsensitive)) cat = &logPosition(); else if(category.contains("orientation",Qt::CaseInsensitive)) cat = &logOrientation(); else if(category.contains("movement",Qt::CaseInsensitive)) cat = &logMovement(); else if(category.contains("chat",Qt::CaseInsensitive)) cat = &logChat(); else if(category.contains("infomsg",Qt::CaseInsensitive)) cat = &logInfoMsg(); else if(category.contains("emotes",Qt::CaseInsensitive)) cat = &logEmotes(); else if(category.contains("target",Qt::CaseInsensitive)) cat = &logTarget(); else if(category.contains("spawn",Qt::CaseInsensitive)) cat = &logSpawn(); else if(category.contains("mapevents",Qt::CaseInsensitive)) cat = &logMapEvents(); else if (category.contains("mapxfers",Qt::CaseInsensitive)) cat = &logMapXfers(); else if(category.contains("slashcommand",Qt::CaseInsensitive)) cat = &logSlashCommand(); else if(category.contains("description",Qt::CaseInsensitive)) cat = &logDescription(); else if(category.contains("friends",Qt::CaseInsensitive)) cat = &logFriends(); else if(category.contains("minimap",Qt::CaseInsensitive)) cat = &logMiniMap(); else if(category.contains("lfg",Qt::CaseInsensitive)) cat = &logLFG(); else if(category.contains("npcs",Qt::CaseInsensitive)) cat = &logNPCs(); else if(category.contains("animations",Qt::CaseInsensitive)) cat = &logAnimations(); else if(category.contains("powers",Qt::CaseInsensitive)) cat = &logPowers(); else if(category.contains("trades",Qt::CaseInsensitive)) cat = &logTrades(); else if(category.contains("scripts", Qt::CaseInsensitive)) cat = &logScripts(); else if(category.contains("scenegraph",Qt::CaseInsensitive)) cat = &logSceneGraph(); else return; cat->setEnabled(QtDebugMsg, !cat->isDebugEnabled()); cat->setEnabled(QtInfoMsg, !cat->isInfoEnabled()); cat->setEnabled(QtWarningMsg, !cat->isWarningEnabled()); cat->setEnabled(QtCriticalMsg, !cat->isCriticalEnabled()); dumpLogging(); }