Made trace file for Qt debugging output a CMake build option.

WSJT-X has  a capability of  redirecting Qt debugging  output (qDebug,
qWarning etc.) to  a trace file 'wsjtx_trace.log' which  is created in
the application run directory if not already present.

Setting the  CMake build option WSJT_QDEBUG_TO_FILE to  ON will enable
this feature.

It  should  be  noted  that  this  option is  not  compatible  with  a
distributibutable  official release since  writing to  the application
directory is  not recommended.  Also  in a full  Release configuration
build all  Qt debugging  code is  elided so no  useful trace  would be
obtained anyway.

The CMake option WSJT_QDEBUG_IN_RELEASE  may be useful in concert with
this option as it causes Qt debugging statements to remain in place in
a  Release  build configuration.   Again  not  recommended  in a  full
Release build since the debugging code both slows down the application
and adds unecessary bloat to the executable size.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@4032 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Bill Somerville 2014-04-16 10:58:40 +00:00
parent 5f95e16490
commit a0ec163a9c
3 changed files with 8 additions and 4 deletions

View File

@ -19,7 +19,8 @@ include (${PROJECT_SOURCE_DIR}/CMake/VersionCompute.cmake)
option (UPDATE_TRANSLATIONS "Update source translation translations/*.ts
files (WARNING: make clean will delete the source .ts files! Danger!)")
option (WSJT_SHARED_RUNTIME "Debugging option that allows running from a shared Cloud directory.")
option (WSJT_QDEBUG_IN_RELEASE "Leave qDebug statements in Release configuration.")
option (WSJT_QDEBUG_TO_FILE "Redirect Qt debuging messages to a trace file.")
option (WSJT_QDEBUG_IN_RELEASE "Leave Qt debugging statements in Release configuration.")
option (WSJT_TRACE_CAT "Debugging option that turns on CAT diagnostics.")
option (WSJT_TRACE_CAT_POLLS "Debugging option that turns on CAT diagnostics during polling.")
option (WSJT_HAMLIB_TRACE "Debugging option that turns on full Hamlib internal diagnostics.")

View File

@ -74,11 +74,13 @@ int main(int argc, char *argv[])
}
QSettings settings(config_path.absoluteFilePath (a.applicationName () + ".ini"), QSettings::IniFormat);
#if WSJT_QDEBUG_TO_FILE
// // open a trace file
// TraceFile trace_file {QDir {QApplication::applicationDirPath ()}.absoluteFilePath ("wsjtx_trace.log")};
TraceFile trace_file {QDir {QApplication::applicationDirPath ()}.absoluteFilePath ("wsjtx_trace.log")};
// // announce to log file
// qDebug () << program_title (revision ()) + " - Program startup";
// announce to trace file
qDebug () << program_title (revision ()) + " - Program startup";
#endif
// Create and initialize shared memory segment
// Multiple instances: use rig_name as shared memory key

View File

@ -17,6 +17,7 @@
#cmakedefine WSJT_DOC_DESTINATION "@WSJT_DOC_DESTINATION@"
#cmakedefine01 WSJT_SHARED_RUNTIME
#cmakedefine01 WSJT_QDEBUG_TO_FILE
#cmakedefine01 WSJT_QDEBUG_IN_RELEASE
#cmakedefine01 WSJT_TRACE_CAT
#cmakedefine01 WSJT_TRACE_CAT_POLLS