Changeset 11191 in ntrip for trunk/BNC/src/bncgetthread.cpp


Ignore:
Timestamp:
Nov 10, 2026, 12:11:31 PM (73 minutes ago)
Author:
stuerze
Message:

Structured logging improved

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/bncgetthread.cpp

    r11190 r11191  
    909909        }
    910910        if (!allFound) {
     911          GPSDecoder::t_typeInfo source;   // message with the new type(s)
     912          source._type = obs._type;
     913          source._size = obs._size;
    911914          QString msg;
    912915          QTextStream str(&msg);
    … …  
    915918            str << " " << rnxTypes[iType];
    916919          }
    917           emitContent(_staID + ": Observation Types: " + msg.toLatin1(),  true);
     920          emitContent(_staID + ": Observation Types: " + msg.toLatin1(),  true, source);
    918921        }
    919922      }
    … …  
    923926      for (int ii = 0; ii < decoder()->_antType.size(); ii++) {
    924927        QString ant1 = QString(": Antenna Descriptor: %1 ").arg(decoder()->_antType[ii]._descriptor);
    925         emitContent(_staID + ant1.toLatin1(), true);
     928        emitContent(_staID + ant1.toLatin1(), true, decoder()->_antType[ii]._source);
    926929        if (strlen(decoder()->_antType[ii]._serialnumber)) {
    927930          QString ant2 = QString(": Antenna Serial Number: %1 ").arg(decoder()->_antType[ii]._serialnumber);
    928           emitContent(_staID + ant2.toLatin1(), true);
     931          emitContent(_staID + ant2.toLatin1(), true, decoder()->_antType[ii]._source);
    929932        }
    930933      }
    … …  
    943946        ant2 = QString("%1 ").arg(decoder()->_antList[ii]._yy, 0, 'f', 4).toLatin1();
    944947        ant3 = QString("%1 ").arg(decoder()->_antList[ii]._zz, 0, 'f', 4).toLatin1();
    945         emitContent(_staID + ": " + antT + " (ITRF) X " + ant1 + "m", true);
    946         emitContent(_staID + ": " + antT + " (ITRF) Y " + ant2 + "m", true);
    947         emitContent(_staID + ": " + antT + " (ITRF) Z " + ant3 + "m", true);
     948        emitContent(_staID + ": " + antT + " (ITRF) X " + ant1 + "m", true, decoder()->_antList[ii]._source);
     949        emitContent(_staID + ": " + antT + " (ITRF) Y " + ant2 + "m", true, decoder()->_antList[ii]._source);
     950        emitContent(_staID + ": " + antT + " (ITRF) Z " + ant3 + "m", true, decoder()->_antList[ii]._source);
    948951        double hh = 0.0;
    949952        if (decoder()->_antList[ii]._height_f) {
    … …  
    951954          QByteArray ant4 = QString("%1 ").arg(hh, 0, 'f', 4).toLatin1();
    952955          emitContent(
    953               _staID + ": Antenna height above marker " + ant4 + "m", true);
     956              _staID + ": Antenna height above marker " + ant4 + "m", true,
     957              decoder()->_antList[ii]._source);
    954958        }
    955959        emit(newAntCrd(_staID, decoder()->_antList[ii]._xx,
    … …  
    963967        QString rec2 = QString(": Receiver Firmware Version: %1 ").arg(decoder()->_recType[ii]._firmware);
    964968        QString rec3 = QString(": Receiver Serial Number: %1 ").arg(decoder()->_recType[ii]._serialnumber);
    965         emitContent(_staID + rec1.toLatin1(), true);
    966         emitContent(_staID + rec2.toLatin1(), true);
    967         emitContent(_staID + rec3.toLatin1(), true);
     969        emitContent(_staID + rec1.toLatin1(), true, decoder()->_recType[ii]._source);
     970        emitContent(_staID + rec2.toLatin1(), true, decoder()->_recType[ii]._source);
     971        emitContent(_staID + rec3.toLatin1(), true, decoder()->_recType[ii]._source);
    968972      }
    969973
    … …  
    982986          emitContent(
    983987              _staID + ": GLONASS Slot:Freq " + _gloSlots.join(" ").toLatin1(),
    984               true);
     988              true, decoder()->_gloFrqSource);
    985989        }
    986990      }
    … …  
    990994      if (decoder()->_gloBiasInfo.changed()) {
    991995        QString gloCodePhaseBiases = decoder()->_gloBiasInfo.toString();
    992         emitContent(_staID + gloCodePhaseBiases.toLatin1(), true);
     996        emitContent(_staID + gloCodePhaseBiases.toLatin1(), true, decoder()->_gloBiasSource);
    993997        decoder()->_gloBiasInfo.setChanged(false);
    994998      }
    … …  
    9991003        // Service CRS
    10001004        for (int ii = 0; ii < decoder()->_serviceCrs.size(); ii++) {
     1005          GPSDecoder::t_typeInfo source;
     1006          source._type = decoder()->_serviceCrs[ii]._msgType;
     1007          source._size = decoder()->_serviceCrs[ii]._msgSize;
    10011008          QString servicecrsname  = QString(": Service CRS Name: %1 ").arg(decoder()->_serviceCrs[ii]._name);
    10021009          QString coordinateEpoch = QString(": Service CRS Coordinate Epoch: %1 ").arg(decoder()->_serviceCrs[ii]._coordinateEpoch);
    10031010          //QString ce = QString(": CE: %1 ").arg(decoder()->_serviceCrs[ii]._CE);
    1004           emitContent(_staID + servicecrsname.toLatin1(), true);
    1005           emitContent(_staID + coordinateEpoch.toLatin1(), true);
     1011          emitContent(_staID + servicecrsname.toLatin1(), true, source);
     1012          emitContent(_staID + coordinateEpoch.toLatin1(), true, source);
    10061013          //emitContent(_staID + ce.toLatin1(), true);
    10071014        }
    10081015        // RTCM CRS
    10091016        for (int ii = 0; ii < decoder()->_rtcmCrs.size(); ii++) {
     1017          GPSDecoder::t_typeInfo source;
     1018          source._type = decoder()->_rtcmCrs[ii]._msgType;
     1019          source._size = decoder()->_rtcmCrs[ii]._msgSize;
    10101020          QString rtcmcrsname = QString(": RTCM CRS Name: %1 ").arg(decoder()->_rtcmCrs[ii]._name);
    10111021          QString anchor      = QString(": RTCM CRS Anchor: %1 ").arg(decoder()->_rtcmCrs[ii]._anchor);
    10121022          QString platenumber = QString(": RTCM CRS Plate Number: %1 ").arg(decoder()->_rtcmCrs[ii]._plateNumber);
    1013           emitContent(_staID + rtcmcrsname.toLatin1(), true);
    1014           emitContent(_staID + anchor.toLatin1(), true);
    1015           emitContent(_staID + platenumber.toLatin1(), true);
     1023          emitContent(_staID + rtcmcrsname.toLatin1(), true, source);
     1024          emitContent(_staID + anchor.toLatin1(), true, source);
     1025          emitContent(_staID + platenumber.toLatin1(), true, source);
    10161026          for (int i = 0; i<decoder()->_rtcmCrs[ii]._databaseLinks.size(); i++) {
    10171027            QString dblink = QString(": Database Link: %1 ").arg(decoder()->_rtcmCrs[ii]._databaseLinks[i]);
    1018             emitContent(_staID + dblink.toLatin1(), true);
     1028            emitContent(_staID + dblink.toLatin1(), true, source);
    10191029          }
    10201030        }
    … …  
    10241034        for (int ii = 0; ii < decoder()->_helmertPar.size(); ii++) {
    10251035          t_helmertPar& helmertPar = decoder()->_helmertPar[ii];
     1036          GPSDecoder::t_typeInfo source;
     1037          source._type = helmertPar._msgType;
     1038          source._size = helmertPar._msgSize;
    10261039          bncTime t; t.setmjd(0, helmertPar._mjd); QString dateStr = QString::fromStdString(t.datestr());
    10271040          QString sourcename  = QString(": MT1301 Source Name: %1 ").arg(helmertPar._sourceName);
    … …  
    10371050              .arg(helmertPar._oxr).arg(helmertPar._oyr).arg(helmertPar._ozr);
    10381051          QString parscale = QString(": MT1301 Helmert Par Scale: sc = %1, scr = %2").arg(helmertPar._sc).arg(helmertPar._scr);
    1039           emitContent(_staID + sourcename.toLatin1(), true);
    1040           emitContent(_staID + targetname.toLatin1(), true);
    1041           emitContent(_staID + sysidentnum.toLatin1(), true);
    1042           emitContent(_staID + trafomessageind.toLatin1(), true);
    1043           emitContent(_staID + epoch.toLatin1(), true);
    1044           emitContent(_staID + partrans.toLatin1(), true);
    1045           emitContent(_staID + parrot.toLatin1(), true);
    1046           emitContent(_staID + parscale.toLatin1(), true);
     1052          emitContent(_staID + sourcename.toLatin1(), true, source);
     1053          emitContent(_staID + targetname.toLatin1(), true, source);
     1054          emitContent(_staID + sysidentnum.toLatin1(), true, source);
     1055          emitContent(_staID + trafomessageind.toLatin1(), true, source);
     1056          emitContent(_staID + epoch.toLatin1(), true, source);
     1057          emitContent(_staID + partrans.toLatin1(), true, source);
     1058          emitContent(_staID + parrot.toLatin1(), true, source);
     1059          emitContent(_staID + parscale.toLatin1(), true, source);
    10471060        }
    10481061      }
    … …  
    11631176}
    11641177
    1165 // Content of the stream found by the RTCM scan (miscScanRTCM)
     1178// Content of the stream found by the RTCM scan (miscScanRTCM), with type
     1179// and size of the RTCM message carrying the information
    11661180////////////////////////////////////////////////////////////////////////////
    1167 void bncGetThread::emitContent(const QByteArray& msg, bool showOnScreen) {
    1168   emit newLogRecord(t_logRecord(t_logRecord::info, "stream", "stream_content", _staID, msg),
    1169                     showOnScreen);
    1170 }
     1181void bncGetThread::emitContent(const QByteArray& msg, bool showOnScreen,
     1182                               const GPSDecoder::t_typeInfo& source) {
     1183  t_logRecord rec(t_logRecord::info, "stream", "stream_content", _staID, msg);
     1184  if (source._type) {
     1185    rec.add("message_type", source._type);
     1186  }
     1187  if (source._size) {
     1188    rec.add("size", int(source._size));
     1189  }
     1190  emit newLogRecord(rec, showOnScreen);
     1191}
Note: See TracChangeset for help on using the changeset viewer.