diff --git a/dg-100.cc b/dg-100.cc index ca222a8c5..beb1424fc 100644 --- a/dg-100.cc +++ b/dg-100.cc @@ -135,7 +135,7 @@ Dg100Format::dg100_log(const char* fmt, ...) va_list ap; va_start(ap, fmt); if (global_opts.debug_level > 0) { - db.log(fmt, ap); + db.vlog(fmt, ap); } va_end(ap); } diff --git a/fatal.cc b/fatal.cc index 8c6197ee7..1352df64f 100644 --- a/fatal.cc +++ b/fatal.cc @@ -60,6 +60,9 @@ warning(const char* fmt, ...) va_start(ap, fmt); QString msg = QString::vasprintf(fmt, ap); va_end(ap); + if (msg.endsWith('\n')) { + msg.chop(1); + } qWarning().noquote() << msg; } @@ -70,6 +73,9 @@ info(const char* fmt, ...) va_start(ap, fmt); QString msg = QString::vasprintf(fmt, ap); va_end(ap); + if (msg.endsWith('\n')) { + msg.chop(1); + } qInfo().noquote() << msg; } @@ -80,6 +86,9 @@ debug(const char* fmt, ...) va_start(ap, fmt); QString msg = QString::vasprintf(fmt, ap); va_end(ap); + if (msg.endsWith('\n')) { + msg.chop(1); + } qDebug().noquote() << msg; } diff --git a/main.cc b/main.cc index 0ec5fbf2d..0b210718a 100644 --- a/main.cc +++ b/main.cc @@ -25,6 +25,7 @@ #include // for QCoreApplication #include // for QDateTime +#include // for QDebug #include // for QElapsedTimer #include // for QFile #include // for QIODevice::ReadOnly @@ -55,7 +56,6 @@ #include "session.h" // for start_session, session_exit, session_init #include "src/core/datetime.h" // for DateTime #include "src/core/file.h" // for File -#include "src/core/logging.h" // for Warning #include "src/core/usasciicodec.h" // for UsAsciiCodec #include "vecs.h" // for Vecs @@ -278,7 +278,7 @@ run_reader(Vecs::fmtinfo_t& ivecs, const QString& fname) } setMessagePattern(); if (global_opts.debug_level > 0) { - Warning().noquote() << QStringLiteral("reader %1 took %2 seconds.") + qDebug().noquote() << QStringLiteral("reader %1 took %2 seconds.") .arg(ivecs.fmtname, QString::number(timer.elapsed()/1000.0, 'f', 3)); } } @@ -312,7 +312,7 @@ run_writer(Vecs::fmtinfo_t& ovecs, const QString& ofname) } setMessagePattern(); if (global_opts.debug_level > 0) { - Warning().noquote() << QStringLiteral("writer %1 took %2 seconds.") + qDebug().noquote() << QStringLiteral("writer %1 took %2 seconds.") .arg(ovecs.fmtname, QString::number(timer.elapsed()/1000.0, 'f', 3)); } } @@ -499,7 +499,7 @@ run(const char* prog_name) } setMessagePattern(); if (global_opts.debug_level > 0) { - Warning().noquote() << QStringLiteral("filter %1 took %2 seconds.") + qDebug().noquote() << QStringLiteral("filter %1 took %2 seconds.") .arg(filter.fltname, QString::number(timer.elapsed()/1000.0, 'f', 3)); } } else { @@ -777,7 +777,7 @@ main(int argc, char* argv[]) #endif if constexpr (DEBUG_LOCALE) { - printf("Initial locale: %s\n",setlocale(LC_ALL, nullptr)); + debug("Initial locale: %s\n",setlocale(LC_ALL, nullptr)); } // Create a QCoreApplication object to handle application initialization. @@ -794,7 +794,7 @@ main(int argc, char* argv[]) // as opposed to the initial default "C" locale. // This was demonstrated with Qt5 on Mac OS X. if constexpr (DEBUG_LOCALE) { - printf("Locale after initial setup: %s\n",setlocale(LC_ALL, nullptr)); + debug("Locale after initial setup: %s\n",setlocale(LC_ALL, nullptr)); } // As recommended in QCoreApplication reset the locale to the default. // Note the documentation says to set LC_NUMERIC, but QCoreApplicationPrivate::initLocale() @@ -802,21 +802,21 @@ main(int argc, char* argv[]) // Perhaps we should restore LC_ALL instead of only LC_NUMERIC. if (strcmp(setlocale(LC_NUMERIC,nullptr), "C") != 0) { if constexpr (DEBUG_LOCALE) { - printf("Resetting LC_NUMERIC\n"); + debug("Resetting LC_NUMERIC\n"); } setlocale(LC_NUMERIC,"C"); if constexpr (DEBUG_LOCALE) { - printf("LC_ALL: %s\n",setlocale(LC_ALL, nullptr)); + debug("LC_ALL: %s\n",setlocale(LC_ALL, nullptr)); } } /* reset LC_TIME for strftime */ if (strcmp(setlocale(LC_TIME,nullptr), "C") != 0) { if constexpr (DEBUG_LOCALE) { - printf("Resetting LC_TIME\n"); + debug("Resetting LC_TIME\n"); } setlocale(LC_TIME,"C"); if constexpr (DEBUG_LOCALE) { - printf("LC_ALL: %s\n",setlocale(LC_ALL, nullptr)); + debug("LC_ALL: %s\n",setlocale(LC_ALL, nullptr)); } } qInstallMessageHandler(MessageHandler); diff --git a/reference/dg200erase.log b/reference/dg200erase.log index 706e2cbbc..9a7f915a0 100644 --- a/reference/dg200erase.log +++ b/reference/dg200erase.log @@ -1,8 +1,8 @@ -TX: Frame Start a0 a2 Payload_Len 0003 Cmd: getfileheader -RX: Start a0a2 Len 0005 Cmd: getfileheader -found 0 headers, nextheader=0 -no further headers, aborting the loop -TX: Frame Start a0 a2 Payload_Len 0001 Cmd: getconfig -RX: Start a0a2 Len 002e Cmd: getconfig -TX: Frame Start a0 a2 Payload_Len 0003 Cmd: erase -RX: Start a0a2 Len 0005 Cmd: erase +dg-200-bin: TX: Frame Start a0 a2 Payload_Len 0003 Cmd: getfileheader +dg-200-bin: RX: Start a0a2 Len 0005 Cmd: getfileheader +dg-200-bin: found 0 headers, nextheader=0 +dg-200-bin: no further headers, aborting the loop +dg-200-bin: TX: Frame Start a0 a2 Payload_Len 0001 Cmd: getconfig +dg-200-bin: RX: Start a0a2 Len 002e Cmd: getconfig +dg-200-bin: TX: Frame Start a0 a2 Payload_Len 0003 Cmd: erase +dg-200-bin: RX: Start a0a2 Len 0005 Cmd: erase diff --git a/reference/validate_debug.log b/reference/validate_debug.log index 55630cc0c..343d8f61f 100644 --- a/reference/validate_debug.log +++ b/reference/validate_debug.log @@ -1,13 +1,13 @@ - -Processing waypts -point ct: 2, waypt_count: 2 - -Processing routes -route 0 ct: 2, waypt_count: 2, segments 1 -route head ct: 1, route_count: 1, total segment count: 1 -total route point ct: 2, route_waypt_count: 2 - -Processing tracks -track 0 ct: 2, waypt_count: 2, segments 1 -track head ct: 1, track_count: 1, total segment count: 1 -total track point ct: 2, track_waypt_count: 2 +validate: +validate: Processing waypts +validate: point ct: 2, waypt_count: 2 +validate: +validate: Processing routes +validate: route 0 ct: 2, waypt_count: 2, segments 1 +validate: route head ct: 1, route_count: 1, total segment count: 1 +validate: total route point ct: 2, route_waypt_count: 2 +validate: +validate: Processing tracks +validate: track 0 ct: 2, waypt_count: 2, segments 1 +validate: track head ct: 1, track_count: 1, total segment count: 1 +validate: total track point ct: 2, track_waypt_count: 2