Ignore:
Timestamp:
Nov 9, 2026, 12:15:48 PM (12 hours ago)
Author:
stuerze
Message:

Structured logging improved

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/combination/bnccomb.cpp

    r11158 r11185  
    209209  _rtnetDecoder = new bncRtnetDecoder();
    210210
    211   connect(this, SIGNAL(newMessage(QByteArray,bool)), BNC_CORE, SLOT(slotMessage(const QByteArray,bool)));
     211  BNC_CORE->connectMessages(this, "cmb");
     212  BNC_CORE->connectLogRecords(this, "cmb");
    212213
    213214  // Reference signals of the clocks
    214215  for (const QString& err : t_ssrRefSig::init()) {
    215     emit newMessage(("bncComb: " + err).toLatin1(), true);
     216    emit newLogRecord(t_logRecord::message(t_logRecord::warning, ("bncComb: " + err).toLatin1()), true);
    216217  }
    217218  if (!t_ssrRefSig::allDefault()) {
    218     emit newMessage(("bncComb: reference signals of the clocks " + t_ssrRefSig::currentString()).toLatin1(), true);
     219    emit newLogRecord(t_logRecord::message(t_logRecord::info, ("bncComb: reference signals of the clocks " + t_ssrRefSig::currentString()).toLatin1()), true);
    219220  }
    220221
    … …  
    278279    _antex = new bncAntex();
    279280    if (_antex->readFile(antexFileName) != success) {
    280       emit newMessage("bncComb: wrong ANTEX file", true);
     281      emit newLogRecord(t_logRecord::message(t_logRecord::warning, "bncComb: wrong ANTEX file"), true);
    281282      delete _antex;
    282283      _antex = 0;
    283284    }
    284285    else {
    285       emit newMessage("bncComb: " + _antex->info().toLatin1(), true);
     286      emit newLogRecord(t_logRecord::message(t_logRecord::info, "bncComb: " + _antex->info().toLatin1()), true);
    286287    }
    287288  }
    … …  
    302303      it.value() = false;
    303304    }
    304     emit newMessage("bncComb: APC and CoM streams configured - combination in the CoM frame, "
    305                     "orbits of the APC streams converted to CoM", true);
     305    emit newLogRecord(t_logRecord::message(t_logRecord::info, "bncComb: APC and CoM streams configured - combination in the CoM frame, "
     306                    "orbits of the APC streams converted to CoM"), true);
    306307  }
    307308  else if (hasAPC && hasCoM) {
    308     emit newMessage("bncComb: APC and CoM streams configured, but no ANTEX file - only the streams "
    309                     "with the reference point of the master AC are combined", true);
     309    emit newLogRecord(t_logRecord::message(t_logRecord::warning, "bncComb: APC and CoM streams configured, but no ANTEX file - only the streams "
     310                    "with the reference point of the master AC are combined"), true);
    310311  }
    311312  if (!_antex && hasCoM) {
    312     emit newMessage("bncComb: CoM streams configured, but no ANTEX file - the combined orbits (INTERNAL) "
    313                     "may refer to the CoM, while the PPP assumes the APC", true);
     313    emit newLogRecord(t_logRecord::message(t_logRecord::warning, "bncComb: CoM streams configured, but no ANTEX file - the combined orbits (INTERNAL) "
     314                    "may refer to the CoM, while the PPP assumes the APC"), true);
    314315  }
    315316
    … …  
    322323    _bsx = new bncBiasSnx();
    323324    if (_bsx->readFile(bsxFileName) != success) {
    324       emit newMessage("bncComb: wrong Bias SINEX file", true);
     325      emit newLogRecord(t_logRecord::message(t_logRecord::warning, "bncComb: wrong Bias SINEX file"), true);
    325326      delete _bsx;
    326327      _bsx = 0;
    … …  
    418419
    419420  if (bsxFileName.isEmpty()) {
    420     emit newMessage("bncComb: no Bias SINEX file specified", true);
     421    emit newLogRecord(t_logRecord::message(t_logRecord::info, "bncComb: no Bias SINEX file specified"), true);
    421422    return;
    422423  }
    … …  
    425426  }
    426427  if (_bsx->readFile(bsxFileName) != success) {
    427     emit newMessage("bncComb: wrong Bias SINEX file", true);
     428    emit newLogRecord(t_logRecord::message(t_logRecord::warning, "bncComb: wrong Bias SINEX file"), true);
    428429    delete _bsx;
    429430    _bsx = 0;
    430431  }
    431432  else {
    432     emit newMessage("bncComb: successfully read Bias SINEX file", true);
     433    emit newLogRecord(t_logRecord::message(t_logRecord::info, "bncComb: successfully read Bias SINEX file"), true);
    433434  }
    434435
    … …  
    638639      if (!warned.valid() || newClk._time - warned >= 3600.0) {
    639640        warned = newClk._time;
    640         emit newMessage("bncComb: " + acName.toLatin1() + " " + QByteArray(1, sys) + " not combined: its orbits refer to the " +
     641        emit newLogRecord(t_logRecord::message(t_logRecord::warning, "bncComb: " + acName.toLatin1() + " " + QByteArray(1, sys) + " not combined: its orbits refer to the " +
    641642                        (isAPC ? "APC" : "CoM") + ", those of the master AC " + _masterOrbitAC[sys].toLatin1() +
    642643                        " to the " + (isAPC ? "CoM" : "APC") +
    643                         " (an ANTEX file allows to combine both in the CoM frame)", true);
     644                        " (an ANTEX file allows to combine both in the CoM frame)"), true);
    644645      }
    645646      continue;
    … …  
    651652      if (fabs(currentTime - newClk._time) > 60.0) { // future or very old data sets
    652653  #ifdef BNC_DEBUG_CMB
    653         emit newMessage("bncComb: future or very old data sets: " + acName.toLatin1() + " " + newClk._prn.toString().c_str() +
     654        emit newLogRecord(t_logRecord::debugMessage("cmb", "bncComb: future or very old data sets: " + acName.toLatin1() + " " + newClk._prn.toString().c_str() +
    654655            QString(" %1 ").arg(newClk._time.timestr().c_str()).toLatin1() + "vs. current time" +
    655             QString(" %1 ").arg(currentTime.timestr().c_str()).toLatin1(), true);
     656            QString(" %1 ").arg(currentTime.timestr().c_str()).toLatin1()), true);
    656657  #endif
    657658        continue;
    … …  
    663664    if (_resTime.valid() && newClk._time <= _resTime) {
    664665#ifdef BNC_DEBUG_CMB
    665       emit newMessage("bncComb: old correction: " + acName.toLatin1() + " " + newClk._prn.toString().c_str() +
     666      emit newLogRecord(t_logRecord::debugMessage("cmb", "bncComb: old correction: " + acName.toLatin1() + " " + newClk._prn.toString().c_str() +
    666667          QString(" %1 ").arg(newClk._time.timestr().c_str()).toLatin1() + "vs. last processing Epoch" +
    667           QString(" %1 ").arg(_resTime.timestr().c_str()).toLatin1(), true);
     668          QString(" %1 ").arg(_resTime.timestr().c_str()).toLatin1()), true);
    668669#endif
    669670      continue;
    … …  
    780781    + QString(" %1 -> %2 %3").arg(corr->_iod,3).arg(lastEph->IOD(),3).arg(dC*t_CST::c, 8, 'f', 4);
    781782
    782   emit newMessage(msg.toLatin1(), false);
     783  emit newLogRecord(t_logRecord::message(t_logRecord::info, msg.toLatin1()), false);
    783784
    784785  corr->_iod = lastEph->IOD();
    … …  
    800801    QString msg = _antexReloader.update(_antex, epoTime);
    801802    if (!msg.isEmpty()) {
    802       emit newMessage(("bncComb: " + msg).toLatin1(), true);
     803      emit newLogRecord(t_logRecord::message(t_logRecord::info, ("bncComb: " + msg).toLatin1()), true);
    803804    }
    804805  }
    … …  
    860861    if (ephLast == 0) {
    861862#ifdef BNC_DEBUG_CMB
    862       emit newMessage("bncComb: eph not found for "  + prnStr.mid(0,3).toLatin1(), true);
     863      emit newLogRecord(t_logRecord::debugMessage("cmb", "bncComb: eph not found for "  + prnStr.mid(0,3).toLatin1()), true);
    863864#endif
    864865      delete _newCorr; _newCorr = 0;
    … …  
    870871             ephLast->checkState() == t_eph::unhealthy) {
    871872#ifdef BNC_DEBUG_CMB
    872       emit newMessage("bncComb: ephLast not ok (checkState: " +  ephLast->checkStateToString().toLatin1() + ") for "  + prnStr.mid(0,3).toLatin1(), true);
     873      emit newLogRecord(t_logRecord::debugMessage("cmb", "bncComb: ephLast not ok (checkState: " +  ephLast->checkStateToString().toLatin1() + ") for "  + prnStr.mid(0,3).toLatin1()), true);
    873874#endif
    874875      delete _newCorr; _newCorr = 0;
    … …  
    888889      else {
    889890#ifdef BNC_DEBUG_CMB
    890         emit newMessage("bncComb: eph not found for "  + prnStr.mid(0,3).toLatin1() +
    891                         QString(" with IOD %1").arg(_newCorr->_iod).toLatin1(), true);
     891        emit newLogRecord(t_logRecord::debugMessage("cmb", "bncComb: eph not found for "  + prnStr.mid(0,3).toLatin1() +
     892                        QString(" with IOD %1").arg(_newCorr->_iod).toLatin1()), true);
    892893#endif
    893894        delete _newCorr; _newCorr = 0;
    … …  
    955956          }
    956957        }
    957         emit newMessage("bncComb: " + acName.toLatin1() + " provides no code biases for the " +
     958        emit newLogRecord(t_logRecord::message(t_logRecord::warning, "bncComb: " + acName.toLatin1() + " provides no code biases for the " +
    958959                        QByteArray(1, sys) + " reference signal(s)" + missing.toLatin1() +
    959960                        " (e.g. " + prnStr.mid(0,3).toLatin1() + ") - these clocks are combined"
    960961                        " without referring them to the reference signals and, as long as other ACs"
    961                         " provide referred clocks, excluded from the clock datum", false);
     962                        " provide referred clocks, excluded from the clock datum"), false);
    962963      }
    963964    }
    … …  
    11121113      out << "Missing Master, Epoch skipped" << "\n";
    11131114      _buffer.remove(sys);
    1114       emit newMessage(_log, false);
     1115      emit newLogRecord(t_logRecord::message(t_logRecord::info, _log), false);
    11151116      return;
    11161117    }
    … …  
    14111412        out << epoTime.datestr().c_str() << " " << epoTime.timestr().c_str()
    14121413            << " " << msg << "\n";
    1413         emit newMessage("bncComb: " + msg.toLatin1(), true);
     1414        emit newLogRecord(t_logRecord::message(t_logRecord::info, "bncComb: " + msg.toLatin1()), true);
    14141415        resetSatOffsets(sys);
    14151416      }
    … …  
    14401441    if (!warned.valid() || epoTime - warned >= 3600.0) {
    14411442      warned = epoTime;
    1442       emit newMessage("bncComb: " + msg.toLatin1(), true);
     1443      emit newLogRecord(t_logRecord::message(t_logRecord::warning, "bncComb: " + msg.toLatin1()), true);
    14431444    }
    14441445  }
    … …  
    14711472                               &corr->_attYaw) != success) {
    14721473    if (_antex->warnNoSatEntry(corr->_prn, corr->_time)) {
    1473       emit newMessage("bncComb: no satellite antenna entry valid at " +
     1474      emit newLogRecord(t_logRecord::message(t_logRecord::warning, "bncComb: no satellite antenna entry valid at " +
    14741475                      QByteArray(corr->_time.datestr().c_str()) + " " + QByteArray(corr->_time.timestr().c_str()) +
    14751476                      " for " + corr->_prn.mid(0,3).toLatin1() +
    1476                       " in ANTEX file - APC orbit of " + AC->name.toLatin1() + " not converted to CoM, not combined", true);
     1477                      " in ANTEX file - APC orbit of " + AC->name.toLatin1() + " not converted to CoM, not combined"), true);
    14771478    }
    14781479    return failure;
    … …  
    15491550                  .arg(stat.numEpo).arg(median, 0, 'f', 2);
    15501551    out << epoTime.datestr().c_str() << " " << epoTime.timestr().c_str() << " " << msg << "\n";
    1551     emit newMessage("bncComb: " + msg.toLatin1(), true);
     1552    emit newLogRecord(t_logRecord::message(t_logRecord::warning, "bncComb: " + msg.toLatin1()), true);
    15521553  }
    15531554  _outlierStat[sys].clear();
    … …  
    16341635      double age = epoTime - corr->_eph->TOC();
    16351636      if (fabs(age) > 960.0) {
    1636         emit newMessage(QString().asprintf(
     1637        emit newLogRecord(t_logRecord::message(t_logRecord::warning, QString().asprintf(
    16371638          "bncComb: skip %s, GLONASS eph age %.0fs",
    1638           corr->_prn.mid(0,3).toLatin1().data(), age).toLatin1(), false);
     1639          corr->_prn.mid(0,3).toLatin1().data(), age).toLatin1()), false);
    16391640        delete corr;
    16401641        it.remove();
    … …  
    17001701        // converted between antenna phase center and center of mass
    17011702        if (_antex->warnNoSatEntry(corr->_prn, epoTime)) {
    1702           emit newMessage("bncComb: no satellite antenna entry valid at " +
     1703          emit newLogRecord(t_logRecord::message(t_logRecord::warning, "bncComb: no satellite antenna entry valid at " +
    17031704                          QByteArray(epoTime.datestr().c_str()) + " " + QByteArray(epoTime.timestr().c_str()) +
    17041705                          " for " + corr->_prn.mid(0,3).toLatin1() +
    1705                           " in ANTEX file - ANTEX file outdated? Satellite not combined", true);
     1706                          " in ANTEX file - ANTEX file outdated? Satellite not combined"), true);
    17061707        }
    17071708        orbCorrections.pop_back();
    … …  
    17171718      for (const QString& line : yawLogs) {
    17181719        if (!line.contains(":att:")) {
    1719           emit newMessage(("bncComb: " + line.trimmed()).toLatin1(), false);
     1720          emit newLogRecord(t_logRecord::message(t_logRecord::info, ("bncComb: " + line.trimmed()).toLatin1()), false);
    17201721        }
    17211722      }
    … …  
    23182319    if (!warned.valid() || epoTime - warned >= 3600.0) {
    23192320      warned = epoTime;
    2320       emit newMessage("bncComb: " + QByteArray(1, sys) + " " + msg.toLatin1(), false);
     2321      emit newLogRecord(t_logRecord::message(t_logRecord::warning, "bncComb: " + QByteArray(1, sys) + " " + msg.toLatin1()), false);
    23212322    }
    23222323  }
Note: See TracChangeset for help on using the changeset viewer.