Changeset 11185 in ntrip for trunk/BNC/src


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

Structured logging improved

Location:
trunk/BNC/src
Files:
39 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/RTCM3/RTCM3Decoder.cpp

    r11141 r11185  
    916916  else if ((type % 10) < 4) {
    917917#ifdef BNC_DEBUG_OBS
    918     emit(newMessage(QString("%1: Block %2 contain partial data! Ignored!")
    919         .arg(_staID).arg(type).toLatin1(), true));
     918    emit(newLogRecord(t_logRecord::debugMessage("obs", QString("%1: Block %2 contain partial data! Ignored!")
     919        .arg(_staID).arg(type).toLatin1()), true));
    920920#endif
    921921  }
    … …  
    10771077    if (i < 1 || i > 63 ) {
    10781078#ifdef BNC_DEBUG_BCE
    1079       emit(newMessage(QString("%1: Block %2 (G) PRN# is out of range: %3!")
     1079      emit(newLogRecord(t_logRecord::debugMessage("bce", QString("%1: Block %2 (G) PRN# is out of range: %3!")
    10801080           .arg(_staID)
    10811081           .arg(1019,4)
    1082            .arg(i).toLatin1(), true));
     1082           .arg(i).toLatin1()), true));
    10831083#endif
    10841084      return false;
    … …  
    10891089    if (week < 0 || week > 1023) {
    10901090#ifdef BNC_DEBUG_BCE
    1091       emit(newMessage(QString("%1: Block %2 (%3) WEEK # is out of range: %4!")
     1091      emit(newLogRecord(t_logRecord::debugMessage("bce", QString("%1: Block %2 (%3) WEEK # is out of range: %4!")
    10921092           .arg(_staID)
    10931093           .arg(1019,4)
    10941094           .arg(eph._prn.toString().c_str())
    1095            .arg(week).toLatin1(), true));
     1095           .arg(week).toLatin1()), true));
    10961096#endif
    10971097      return false;
    … …  
    11061106    if (i < 0 || i > 604784) {
    11071107#ifdef BNC_DEBUG_BCE
    1108       emit(newMessage(QString("%1: Block %2 (%3) TOC is out of range: %4!")
     1108      emit(newLogRecord(t_logRecord::debugMessage("bce", QString("%1: Block %2 (%3) TOC is out of range: %4!")
    11091109           .arg(_staID)
    11101110           .arg(1019,4)
    11111111           .arg(eph._prn.toString().c_str())
    1112            .arg(i).toLatin1(), true));
     1112           .arg(i).toLatin1()), true));
    11131113#endif
    11141114      return false;
    … …  
    11281128    if (eph._sqrt_A < 1000.0) {
    11291129#ifdef BNC_DEBUG_BCE
    1130       emit(newMessage(QString("%1: Block %2 (%3) SQRT_A %4 m!")
     1130      emit(newLogRecord(t_logRecord::debugMessage("bce", QString("%1: Block %2 (%3) SQRT_A %4 m!")
    11311131           .arg(_staID).arg(1019,4).arg(eph._prn.toString().c_str())
    1132            .arg(eph._sqrt_A,10,'F',3).toLatin1(), true));
     1132           .arg(eph._sqrt_A,10,'F',3).toLatin1()), true));
    11331133#endif
    11341134      return false;
    … …  
    11381138    if (i < 0 || i > 604784) {
    11391139#ifdef BNC_DEBUG_BCE
    1140       emit(newMessage(QString("%1: Block %2 (%3) TOE is out of range: %4!")
     1140      emit(newLogRecord(t_logRecord::debugMessage("bce", QString("%1: Block %2 (%3) TOE is out of range: %4!")
    11411141           .arg(_staID)
    11421142           .arg(1019,4)
    11431143           .arg(eph._prn.toString().c_str())
    1144            .arg(i).toLatin1(), true));
     1144           .arg(i).toLatin1()), true));
    11451145#endif
    11461146      return false;
    … …  
    11971197    if (sv < 1 || sv > 63) {
    11981198#ifdef BNC_DEBUG_BCE
    1199       emit(newMessage(QString("%1: Block %2 (R):  SLOT# is unknown (0) or out of range: %3!")
     1199      emit(newLogRecord(t_logRecord::debugMessage("bce", QString("%1: Block %2 (R):  SLOT# is unknown (0) or out of range: %3!")
    12001200           .arg(_staID)
    12011201           .arg(1020,4)
    1202            .arg(sv).toLatin1(), true));
     1202           .arg(sv).toLatin1()), true));
    12031203#endif
    12041204      return false;
    … …  
    12101210    if (i < 0 || i > 20) {
    12111211#ifdef BNC_DEBUG_BCE
    1212       emit(newMessage(QString("%1: Block %2 (%3): FRQ CHN# is out of range: %4")
     1212      emit(newLogRecord(t_logRecord::debugMessage("bce", QString("%1: Block %2 (%3): FRQ CHN# is out of range: %4")
    12131213           .arg(_staID)
    12141214           .arg(1020,4)
    12151215           .arg(eph._prn.toString().c_str())
    1216            .arg(i).toLatin1(), true));
     1216           .arg(i).toLatin1()), true));
    12171217#endif
    12181218      return false;
    … …  
    12261226    if (i < 0 || i > 23) {
    12271227#ifdef BNC_DEBUG_BCE
    1228       emit(newMessage(QString("%1: Block %2 (%3): T_k (bits 11-7) is out of range: %4")
     1228      emit(newLogRecord(t_logRecord::debugMessage("bce", QString("%1: Block %2 (%3): T_k (bits 11-7) is out of range: %4")
    12291229           .arg(_staID)
    12301230           .arg(1020,4)
    12311231           .arg(eph._prn.toString().c_str())
    1232            .arg(i).toLatin1(), true));
     1232           .arg(i).toLatin1()), true));
    12331233#endif
    12341234      return false;
    … …  
    12381238    if (i < 0 || i > 59) {
    12391239#ifdef BNC_DEBUG_BCE
    1240       emit(newMessage(QString("%1: Block %2 (%3): T_k (bits 6-1) is out of range: %4")
     1240      emit(newLogRecord(t_logRecord::debugMessage("bce", QString("%1: Block %2 (%3): T_k (bits 6-1) is out of range: %4")
    12411241           .arg(_staID)
    12421242           .arg(1020,4)
    12431243           .arg(eph._prn.toString().c_str())
    1244            .arg(i).toLatin1(), true));
     1244           .arg(i).toLatin1()), true));
    12451245#endif
    12461246      return false;
    … …  
    12501250    if (i < 0 || i > 1) {
    12511251#ifdef BNC_DEBUG_BCE
    1252       emit(newMessage(QString("%1: Block %2 (%3): T_k (bit 0) is out of range: %4")
     1252      emit(newLogRecord(t_logRecord::debugMessage("bce", QString("%1: Block %2 (%3): T_k (bit 0) is out of range: %4")
    12531253           .arg(_staID)
    12541254           .arg(1020,4)
    12551255           .arg(eph._prn.toString().c_str())
    1256            .arg(i).toLatin1(), true));
     1256           .arg(i).toLatin1()), true));
    12571257#endif
    12581258      return false;
    … …  
    12691269    if (i < 15 || i > 1425) {
    12701270#ifdef BNC_DEBUG_BCE
    1271       emit(newMessage(QString("%1: Block %2 (%3): T_b is out of range: %4")
     1271      emit(newLogRecord(t_logRecord::debugMessage("bce", QString("%1: Block %2 (%3): T_b is out of range: %4")
    12721272           .arg(_staID)
    12731273           .arg(1020,4)
    12741274           .arg(eph._prn.toString().c_str())
    1275            .arg(i).toLatin1(), true));
     1275           .arg(i).toLatin1()), true));
    12761276#endif
    12771277      return false;
    … …  
    13001300    if (eph._M_NT == 0.0) {
    13011301#ifdef BNC_DEBUG_BCE
    1302       emit(newMessage(QString("%1: Block %2 (%3): NT = %4: missing data!")
    1303            .arg(_staID).arg(1020,4).arg(eph._prn.toString().c_str()).arg(eph._M_NT,4).toLatin1(), true));
     1302      emit(newLogRecord(t_logRecord::debugMessage("bce", QString("%1: Block %2 (%3): NT = %4: missing data!")
     1303           .arg(_staID).arg(1020,4).arg(eph._prn.toString().c_str()).arg(eph._M_NT,4).toLatin1()), true));
    13041304#endif
    13051305      return false;
    … …  
    13091309    if (eph._additional_data_availability == 0.0) {
    13101310#ifdef BNC_DEBUG_BCE
    1311       emit(newMessage(QString("%1: Block %2 (%3): ADD = %4: missing data!")
     1311      emit(newLogRecord(t_logRecord::debugMessage("bce", QString("%1: Block %2 (%3): ADD = %4: missing data!")
    13121312           .arg(_staID).arg(1020,4).arg(eph._prn.toString().c_str())
    1313            .arg(eph._additional_data_availability).toLatin1(), true));
     1313           .arg(eph._additional_data_availability).toLatin1()), true));
    13141314#endif
    13151315      return false;
    … …  
    13311331    if (eph._xv.Rows(1,3).NormFrobenius() < 1.0) {
    13321332#ifdef BNC_DEBUG_BCE
    1333       emit(newMessage(QString("%1: Block %2 (%3): zero position!")
    1334            .arg(_staID).arg(1020,4).arg(eph._prn.toString().c_str()).toLatin1(), true));
     1333      emit(newLogRecord(t_logRecord::debugMessage("bce", QString("%1: Block %2 (%3): zero position!")
     1334           .arg(_staID).arg(1020,4).arg(eph._prn.toString().c_str()).toLatin1()), true));
    13351335#endif
    13361336      return false;
    … …  
    13411341    if (eph._xv.Rows(4,6).NormFrobenius() < 1.0) {
    13421342#ifdef BNC_DEBUG_BCE
    1343       emit(newMessage(QString("%1: Block %2 (%3): zero velocity!")
    1344            .arg(_staID).arg(1020,4).arg(eph._prn.toString().c_str()).toLatin1(), true));
     1343      emit(newLogRecord(t_logRecord::debugMessage("bce", QString("%1: Block %2 (%3): zero velocity!")
     1344           .arg(_staID).arg(1020,4).arg(eph._prn.toString().c_str()).toLatin1()), true));
    13451345#endif
    13461346      return false;
    … …  
    13861386    if (i < 1 || i > 10 ) {
    13871387#ifdef BNC_DEBUG_BCE
    1388       emit(newMessage(QString("%1: Block %2 (J) SAT ID is out of range: %3!")
     1388      emit(newLogRecord(t_logRecord::debugMessage("bce", QString("%1: Block %2 (J) SAT ID is out of range: %3!")
    13891389           .arg(_staID)
    13901390           .arg(1044,4)
    1391            .arg(i).toLatin1(), true));
     1391           .arg(i).toLatin1()), true));
    13921392#endif
    13931393      return false;
    … …  
    14001400    if (i < 0 || i > 604784) {
    14011401#ifdef BNC_DEBUG_BCE
    1402       emit(newMessage(QString("%1: Block %2 (%3) TOC is out of range: %4!")
     1402      emit(newLogRecord(t_logRecord::debugMessage("bce", QString("%1: Block %2 (%3) TOC is out of range: %4!")
    14031403           .arg(_staID)
    14041404           .arg(1044,4)
    14051405           .arg(eph._prn.toString().c_str())
    1406            .arg(i).toLatin1(), true));
     1406           .arg(i).toLatin1()), true));
    14071407#endif
    14081408      return false;
    … …  
    14231423    if (eph._sqrt_A < 1000.0) {
    14241424#ifdef BNC_DEBUG_BCE
    1425       emit(newMessage(QString("%1: Block %2 (%3) SQRT_A %4 m!")
     1425      emit(newLogRecord(t_logRecord::debugMessage("bce", QString("%1: Block %2 (%3) SQRT_A %4 m!")
    14261426           .arg(_staID).arg(1044,4).arg(eph._prn.toString().c_str())
    1427            .arg(eph._sqrt_A,10,'F',3).toLatin1(), true));
     1427           .arg(eph._sqrt_A,10,'F',3).toLatin1()), true));
    14281428#endif
    14291429      return false;
    … …  
    14331433    if (i < 0 || i > 604784) {
    14341434#ifdef BNC_DEBUG_BCE
    1435       emit(newMessage(QString("%1: Block %2 (%3) TOE is out of range: %4!")
     1435      emit(newLogRecord(t_logRecord::debugMessage("bce", QString("%1: Block %2 (%3) TOE is out of range: %4!")
    14361436           .arg(_staID)
    14371437           .arg(1044,4)
    14381438           .arg(eph._prn.toString().c_str())
    1439            .arg(i).toLatin1(), true));
     1439           .arg(i).toLatin1()), true));
    14401440#endif
    14411441      return false;
    … …  
    14571457    if (week < 0 || week > 1023) {
    14581458#ifdef BNC_DEBUG_BCE
    1459       emit(newMessage(QString("%1: Block %2 (%3) WEEK # is out of range: %4!")
     1459      emit(newLogRecord(t_logRecord::debugMessage("bce", QString("%1: Block %2 (%3) WEEK # is out of range: %4!")
    14601460           .arg(_staID)
    14611461           .arg(1044,4)
    14621462           .arg(eph._prn.toString().c_str())
    1463            .arg(week).toLatin1(), true));
     1463           .arg(week).toLatin1()), true));
    14641464#endif
    14651465      return false;
    … …  
    15071507    if (i < 1 || i > 63 ) {
    15081508#ifdef BNC_DEBUG_BCE
    1509       emit(newMessage(QString("%1: Block %2 (I) PRN# is out of range: %3!")
     1509      emit(newLogRecord(t_logRecord::debugMessage("bce", QString("%1: Block %2 (I) PRN# is out of range: %3!")
    15101510           .arg(_staID)
    15111511           .arg(1041,4)
    1512            .arg(i).toLatin1(), true));
     1512           .arg(i).toLatin1()), true));
    15131513#endif
    15141514      return false;
    … …  
    15191519    if (week < 0 || week > 1023) {
    15201520#ifdef BNC_DEBUG_BCE
    1521       emit(newMessage(QString("%1: Block %2 (%3) WEEK # is out of range: %4!")
     1521      emit(newLogRecord(t_logRecord::debugMessage("bce", QString("%1: Block %2 (%3) WEEK # is out of range: %4!")
    15221522           .arg(_staID)
    15231523           .arg(1041,4)
    15241524           .arg(eph._prn.toString().c_str())
    1525            .arg(week).toLatin1(), true));
     1525           .arg(week).toLatin1()), true));
    15261526#endif
    15271527      return false;
    … …  
    15361536    if (i < 0 || i > 1048560) {
    15371537#ifdef BNC_DEBUG_BCE
    1538       emit(newMessage(QString("%1: Block %2 (%3) TOC is out of range: %4!")
     1538      emit(newLogRecord(t_logRecord::debugMessage("bce", QString("%1: Block %2 (%3) TOC is out of range: %4!")
    15391539           .arg(_staID)
    15401540           .arg(1041,4)
    15411541           .arg(eph._prn.toString().c_str())
    1542            .arg(i).toLatin1(), true));
     1542           .arg(i).toLatin1()), true));
    15431543#endif
    15441544      return false;
    … …  
    15771577    if (i < 0 || i > 1048560) {
    15781578#ifdef BNC_DEBUG_BCE
    1579       emit(newMessage(QString("%1: Block %2 (%3) TOE is out of range: %4!")
     1579      emit(newLogRecord(t_logRecord::debugMessage("bce", QString("%1: Block %2 (%3) TOE is out of range: %4!")
    15801580           .arg(_staID)
    15811581           .arg(1041,4)
    15821582           .arg(eph._prn.toString().c_str())
    1583            .arg(i).toLatin1(), true));
     1583           .arg(i).toLatin1()), true));
    15841584#endif
    15851585      return false;
    … …  
    15981598    if (eph._sqrt_A < 1000.0) {
    15991599#ifdef BNC_DEBUG_BCE
    1600       emit(newMessage(QString("%1: Block %2 (%3) SQRT_A %4 m!")
     1600      emit(newLogRecord(t_logRecord::debugMessage("bce", QString("%1: Block %2 (%3) SQRT_A %4 m!")
    16011601           .arg(_staID).arg(1041,4).arg(eph._prn.toString().c_str())
    1602            .arg(eph._sqrt_A,10,'F',3).toLatin1(), true));
     1602           .arg(eph._sqrt_A,10,'F',3).toLatin1()), true));
    16031603#endif
    16041604      return false;
    … …  
    16421642    if (i < 0 || i > 38 ) {
    16431643#ifdef BNC_DEBUG_BCE
    1644       emit(newMessage(QString("%1: Block %2 (S) PRN# is out of range: %3!")
     1644      emit(newLogRecord(t_logRecord::debugMessage("bce", QString("%1: Block %2 (S) PRN# is out of range: %3!")
    16451645           .arg(_staID)
    16461646           .arg(1043,4)
    1647            .arg(i).toLatin1(), true));
     1647           .arg(i).toLatin1()), true));
    16481648#endif
    16491649      return false;
    … …  
    16561656    if (i < 0 || i > 86384) {
    16571657#ifdef BNC_DEBUG_BCE
    1658       emit(newMessage(QString("%1: Block %2 (%3) TOC is out of range: %4!")
     1658      emit(newLogRecord(t_logRecord::debugMessage("bce", QString("%1: Block %2 (%3) TOC is out of range: %4!")
    16591659           .arg(_staID)
    16601660           .arg(1043,4)
    16611661           .arg(eph._prn.toString().c_str())
    1662            .arg(i).toLatin1(), true));
     1662           .arg(i).toLatin1()), true));
    16631663#endif
    16641664      return false;
    … …  
    16851685    if (pos.NormFrobenius() < 1.0) {
    16861686#ifdef BNC_DEBUG_BCE
    1687       emit(newMessage(QString("%1: Block %2 (%3): zero position!")
    1688            .arg(_staID).arg(1043,4).arg(eph._prn.toString().c_str()).toLatin1(), true));
     1687      emit(newLogRecord(t_logRecord::debugMessage("bce", QString("%1: Block %2 (%3): zero position!")
     1688           .arg(_staID).arg(1043,4).arg(eph._prn.toString().c_str()).toLatin1()), true));
    16891689#endif
    16901690      return false;
    … …  
    17201720  size -= 6; /* header + crc */
    17211721  GETBITS(i, 12)
     1722#ifdef BNC_DEBUG_BCE
     1723  const int mnum = i;   // message number for the debug messages
     1724#endif
    17221725
    17231726  if ((i == 1046 && size == 61) ||
    … …  
    17321735    if (i < 1 || i > 36 ) { // max. constellation within I/NAV / F/NAV frames is 36
    17331736#ifdef BNC_DEBUG_BCE
    1734       emit(newMessage(QString("%1: Block %2 (E) PRN# is out of range: %3!")
     1737      emit(newLogRecord(t_logRecord::debugMessage("bce", QString("%1: Block %2 (E) PRN# is out of range: %3!")
    17351738           .arg(_staID)
    17361739           .arg(mnum,4)
    1737            .arg(i).toLatin1(), true));
     1740           .arg(i).toLatin1()), true));
    17381741#endif
    17391742      return false;
    … …  
    17451748    if (week < 0 || week > 4095) {
    17461749#ifdef BNC_DEBUG_BCE
    1747       emit(newMessage(QString("%1: Block %2 (%3) WEEK # is out of range: %4!")
     1750      emit(newLogRecord(t_logRecord::debugMessage("bce", QString("%1: Block %2 (%3) WEEK # is out of range: %4!")
    17481751           .arg(_staID)
    17491752           .arg(mnum,4)
    17501753           .arg(eph._prn.toString().c_str())
    1751            .arg(week).toLatin1(), true));
     1754           .arg(week).toLatin1()), true));
    17521755#endif
    17531756      return false;
    … …  
    17671770    if (i < 0 || i > 604740) {
    17681771#ifdef BNC_DEBUG_BCE
    1769       emit(newMessage(QString("%1: Block %2 (%3) TOC is out of range: %4!")
     1772      emit(newLogRecord(t_logRecord::debugMessage("bce", QString("%1: Block %2 (%3) TOC is out of range: %4!")
    17701773           .arg(_staID)
    17711774           .arg(mnum,4)
    17721775           .arg(eph._prn.toString().c_str())
    1773            .arg(i).toLatin1(), true));
     1776           .arg(i).toLatin1()), true));
    17741777#endif
    17751778      return false;
    … …  
    17891792    if (i < 0 || i > 604740) {
    17901793#ifdef BNC_DEBUG_BCE
    1791       emit(newMessage(QString("%1: Block %2 (%3) TOE is out of range: %4!")
     1794      emit(newLogRecord(t_logRecord::debugMessage("bce", QString("%1: Block %2 (%3) TOE is out of range: %4!")
    17921795           .arg(_staID)
    17931796           .arg(mnum,4)
    17941797           .arg(eph._prn.toString().c_str())
    1795            .arg(i).toLatin1(), true));
     1798           .arg(i).toLatin1()), true));
    17961799#endif
    17971800      return false;
    … …  
    18201823      if (eph._E5b_HS != eph._E1B_HS) {
    18211824#ifdef BNC_DEBUG_BCE
    1822         emit(newMessage(QString("%1: Block %2 (%3) SHS E5b %4 E1B %5: inconsistent health!")
     1825        emit(newLogRecord(t_logRecord::debugMessage("bce", QString("%1: Block %2 (%3) SHS E5b %4 E1B %5: inconsistent health!")
    18231826             .arg(_staID).arg(1046,4).arg(eph._prn.toString().c_str())
    1824              .arg(eph._E5b_HS).arg(eph._E1B_HS).toLatin1(), true));
     1827             .arg(eph._E5b_HS).arg(eph._E1B_HS).toLatin1()), true));
    18251828#endif
    18261829        return false;
    … …  
    18291832          (eph._BGD_1_5B == 0.0 && fabs(eph._BGD_1_5A) > 1e-9)) {
    18301833#ifdef BNC_DEBUG_BCE
    1831         emit(newMessage(QString("%1: Block %2 (%3) BGD_1_5a = %4 BGD_1_5b = %5: inconsistent BGD!")
     1834        emit(newLogRecord(t_logRecord::debugMessage("bce", QString("%1: Block %2 (%3) BGD_1_5a = %4 BGD_1_5b = %5: inconsistent BGD!")
    18321835             .arg(_staID).arg(1046,4).arg(eph._prn.toString().c_str())
    1833              .arg(eph._BGD_1_5A,10,'E',3).arg(eph._BGD_1_5B,10,'E',3).toLatin1(), true));
     1836             .arg(eph._BGD_1_5A,10,'E',3).arg(eph._BGD_1_5B,10,'E',3).toLatin1()), true));
    18341837#endif
    18351838        return false;
    … …  
    18521855    if (eph._sqrt_A < 1000.0) {
    18531856#ifdef BNC_DEBUG_BCE
    1854       emit(newMessage(QString("%1: Block %2 (%3) SQRT_A %4 m!")
     1857      emit(newLogRecord(t_logRecord::debugMessage("bce", QString("%1: Block %2 (%3) SQRT_A %4 m!")
    18551858           .arg(_staID).arg(eph._inav? 1046 : 1045,4).arg(eph._prn.toString().c_str())
    1856            .arg(eph._sqrt_A,10,'F',3).toLatin1(), true));
     1859           .arg(eph._sqrt_A,10,'F',3).toLatin1()), true));
    18571860#endif
    18581861      return false;
    … …  
    18861889    if (i < 1 || i > 63 ) {
    18871890#ifdef BNC_DEBUG_BCE
    1888       emit(newMessage(QString("%1: Block %2 (C) PRN# is out of range: %3!")
     1891      emit(newLogRecord(t_logRecord::debugMessage("bce", QString("%1: Block %2 (C) PRN# is out of range: %3!")
    18891892           .arg(_staID)
    18901893           .arg(1042,4)
    1891            .arg(i).toLatin1(), true));
     1894           .arg(i).toLatin1()), true));
    18921895#endif
    18931896      return false;
    … …  
    18991902    if (week < 0 || week > 8191) {
    19001903#ifdef BNC_DEBUG_BCE
    1901       emit(newMessage(QString("%1: Block %2 (%3) WEEK # is out of range: %4!")
     1904      emit(newLogRecord(t_logRecord::debugMessage("bce", QString("%1: Block %2 (%3) WEEK # is out of range: %4!")
    19021905           .arg(_staID)
    19031906           .arg(1042,4)
    19041907           .arg(eph._prn.toString().c_str())
    1905            .arg(week).toLatin1(), true));
     1908           .arg(week).toLatin1()), true));
    19061909#endif
    19071910      return false;
    … …  
    19221925    if (i < 0 || i > 604792) {
    19231926#ifdef BNC_DEBUG_BCE
    1924       emit(newMessage(QString("%1: Block %2 (%3) TOC is out of range: %4!")
     1927      emit(newLogRecord(t_logRecord::debugMessage("bce", QString("%1: Block %2 (%3) TOC is out of range: %4!")
    19251928           .arg(_staID)
    19261929           .arg(1042,4)
    19271930           .arg(eph._prn.toString().c_str())
    1928            .arg(i).toLatin1(), true));
     1931           .arg(i).toLatin1()), true));
    19291932#endif
    19301933      return false;
    … …  
    19441947    if (eph._sqrt_A < 1000.0) {
    19451948#ifdef BNC_DEBUG_BCE
    1946       emit(newMessage(QString("%1: Block %2 (%3) SQRT_A %4 m!")
     1949      emit(newLogRecord(t_logRecord::debugMessage("bce", QString("%1: Block %2 (%3) SQRT_A %4 m!")
    19471950           .arg(_staID).arg(1042,4).arg(eph._prn.toString().c_str())
    1948            .arg(eph._sqrt_A,10,'F',3).toLatin1(), true));
     1951           .arg(eph._sqrt_A,10,'F',3).toLatin1()), true));
    19491952#endif
    19501953      return false;
    … …  
    19541957    if (i < 0 || i > 604792) {
    19551958#ifdef BNC_DEBUG_BCE
    1956       emit(newMessage(QString("%1: Block %2 (%3) TOE is out of range: %4!")
     1959      emit(newLogRecord(t_logRecord::debugMessage("bce", QString("%1: Block %2 (%3) TOE is out of range: %4!")
    19571960           .arg(_staID)
    19581961           .arg(1042,4)
    19591962           .arg(eph._prn.toString().c_str())
    1960            .arg(i).toLatin1(), true));
     1963           .arg(i).toLatin1()), true));
    19611964#endif
    19621965      return false;
    … …  
    23292332          case 1003:
    23302333#ifdef BNC_DEBUG_OBS
    2331             emit(newMessage(QString("%1: Block %2 contain partial data! Ignored!")
    2332                  .arg(_staID).arg(id).toLatin1(), true));
     2334            emit(newLogRecord(t_logRecord::debugMessage("obs", QString("%1: Block %2 contain partial data! Ignored!")
     2335                 .arg(_staID).arg(id).toLatin1()), true));
    23332336#endif
    23342337            break; /* no use decoding partial data ATM, remove break when data can be used */
    … …  
    23412344          case 1011:
    23422345#ifdef BNC_DEBUG_OBS
    2343             emit(newMessage(QString("%1: Block %2 contain partial data! Ignored!")
    2344                  .arg(_staID).arg(id).toLatin1(), true));
     2346            emit(newLogRecord(t_logRecord::debugMessage("obs", QString("%1: Block %2 contain partial data! Ignored!")
     2347                 .arg(_staID).arg(id).toLatin1()), true));
    23452348#endif
    23462349            break; /* no use decoding partial data ATM, remove break when data can be used */
    … …  
    24912494  if (!_prnOutOfRangeLogged.contains(prnStr)) {
    24922495    _prnOutOfRangeLogged.insert(prnStr);
    2493     emit newMessage(QString("%1: satellite %2 outside the range supported by BNC - not usable for processing")
    2494                     .arg(_staID).arg(prnStr).toLatin1(), true);
     2496    emit newLogRecord(t_logRecord::message(t_logRecord::warning, QString("%1: satellite %2 outside the range supported by BNC - not usable for processing")
     2497                    .arg(_staID).arg(prnStr).toLatin1()), true);
    24952498  }
    24962499}
  • trunk/BNC/src/RTCM3/RTCM3Decoder.h

    r11057 r11185  
    3535#include "bncrawfile.h"
    3636#include "ephemeris.h"
     37#include "bnclog.h"
    3738
    3839class RTCM3Decoder : public QObject, public GPSDecoder {
    … …  
    5455 signals:
    5556  void newMessage(QByteArray msg,bool showOnScreen);
     57  void newLogRecord(t_logRecord rec, bool showOnScreen);
    5658  void newGPSEph(t_ephGPS eph);
    5759  void newGlonassEph(t_ephGlo eph);
  • trunk/BNC/src/RTCM3/RTCM3coDecoder.cpp

    r11115 r11185  
    9696          BNC_CORE, SIGNAL(providerIDChanged(QString)), conType);
    9797
    98   connect(this, SIGNAL(newMessage(QByteArray,bool)),
    99           BNC_CORE, SLOT(slotMessage(const QByteArray,bool)));
     98  BNC_CORE->connectMessages(this, "ssr");
     99  BNC_CORE->connectLogRecords(this, "ssr");
    100100
    101101  reset();
    … …  
    300300        }
    301301        else {
    302           emit newMessage("RTCM3coDecoder: _lastTime invalid: " + _staID.toLatin1(), true);
     302          emit newLogRecord(t_logRecord::message(t_logRecord::warning, "RTCM3coDecoder: _lastTime invalid: " + _staID.toLatin1()), true);
    303303          retCode = failure;
    304304        }
    … …  
    962962
    963963  if (alreadySet && different) {
    964     emit newMessage("RTCM3coDecoder: SSR Provider or Service changed " +  newProviderIDStr.toLatin1() + _staID.toLatin1(), true);
     964    emit newLogRecord(t_logRecord::message(t_logRecord::info, "RTCM3coDecoder: SSR Provider or Service changed " +  newProviderIDStr.toLatin1() + _staID.toLatin1()), true);
    965965    emit providerIDChanged(_staID);
    966966  }
    … …  
    11041104
    11051105  if (corrIsOutOfRange) {
    1106     emit newMessage("RTCM3coDecoder: Correction " + ssrParStr.toLatin1()
     1106    emit newLogRecord(t_logRecord::message(t_logRecord::warning, "RTCM3coDecoder: Correction " + ssrParStr.toLatin1()
    11071107        + " (" + ssrParValue.toLatin1() + ") "
    1108         + "is out of range "  + _staID.toLatin1(), true);
     1108        + "is out of range "  + _staID.toLatin1()), true);
    11091109  }
    11101110
    … …  
    12411241        warned = currentTime;
    12421242        if (secOfWeek) {
    1243           emit newMessage(_staID.toLatin1() + ": IGS-SSR GLONASS epoch time erroneously encoded "
     1243          emit newLogRecord(t_logRecord::message(t_logRecord::warning, _staID.toLatin1() + ": IGS-SSR GLONASS epoch time erroneously encoded "
    12441244                          "(UTC seconds of week instead of GPS seconds of week, IGS SSR v1.00 IDF003) "
    1245                           "detected and converted - the SSR encoder should be corrected", true);
     1245                          "detected and converted - the SSR encoder should be corrected"), true);
    12461246        }
    12471247        else {
    1248           emit newMessage(_staID.toLatin1() + ": IGS-SSR GLONASS epoch time in outdated convention "
     1248          emit newLogRecord(t_logRecord::message(t_logRecord::warning, _staID.toLatin1() + ": IGS-SSR GLONASS epoch time in outdated convention "
    12491249                          "(UTC seconds of day instead of GPS seconds of week, IGS SSR v1.00 IDF003) "
    1250                           "detected and converted - the SSR encoder should be updated", true);
     1250                          "detected and converted - the SSR encoder should be updated"), true);
    12511251        }
    12521252      }
    … …  
    12811281      if (!warned.valid() || currentTime - warned >= 3600.0) {
    12821282        warned = currentTime;
    1283         emit newMessage(_staID.toLatin1() + ": IGS-SSR BDS epoch time in outdated convention "
     1283        emit newLogRecord(t_logRecord::message(t_logRecord::warning, _staID.toLatin1() + ": IGS-SSR BDS epoch time in outdated convention "
    12841284                        "(BDT instead of GPS seconds of week, IGS SSR v1.00 IDF003) "
    1285                         "detected and converted - the SSR encoder should be updated", true);
     1285                        "detected and converted - the SSR encoder should be updated"), true);
    12861286      }
    12871287    }
    … …  
    13441344    if (!warned.valid() || currentTime - warned >= 3600.0) {
    13451345      warned = currentTime;
    1346       emit newMessage(QString("%1: %2 SSR epoch time %3 %4 differs by %5 s from the GPS SSR epoch time "
     1346      emit newLogRecord(t_logRecord::message(t_logRecord::warning, QString("%1: %2 SSR epoch time %3 %4 differs by %5 s from the GPS SSR epoch time "
    13471347                              "of the stream - erroneously encoded?")
    13481348                      .arg(_staID).arg(epoSys)
    13491349                      .arg(QString::fromStdString(_lastTime.datestr()))
    13501350                      .arg(QString::fromStdString(_lastTime.timestr(0)))
    1351                       .arg(_lastTime - _lastGpsEpoch, 0, 'f', 0).toLatin1(), true);
     1351                      .arg(_lastTime - _lastGpsEpoch, 0, 'f', 0).toLatin1()), true);
    13521352    }
    13531353  }
    … …  
    13801380  if (!_prnOutOfRangeLogged.contains(prnStr)) {
    13811381    _prnOutOfRangeLogged.insert(prnStr);
    1382     emit newMessage(QString("%1: satellite %2 outside the range supported by BNC - not usable for processing")
    1383                     .arg(_staID).arg(prnStr).toLatin1(), true);
     1382    emit newLogRecord(t_logRecord::message(t_logRecord::warning, QString("%1: satellite %2 outside the range supported by BNC - not usable for processing")
     1383                    .arg(_staID).arg(prnStr).toLatin1()), true);
    13841384  }
    13851385}
    … …  
    14211421    if (!_antennaIODLogged.contains(key)) {
    14221422      _antennaIODLogged.insert(key);
    1423       emit newMessage(QString("%1: GNSS %2 Satellite Antenna IOD switches back %3 -> %4"
     1423      emit newLogRecord(t_logRecord::message(t_logRecord::warning, QString("%1: GNSS %2 Satellite Antenna IOD switches back %3 -> %4"
    14241424                              " - messages of one GNSS must use the same IOD")
    1425                       .arg(_staID).arg(sys).arg(_antennaIODCur[s]).arg(iod).toLatin1(), true);
     1425                      .arg(_staID).arg(sys).arg(_antennaIODCur[s]).arg(iod).toLatin1()), true);
    14261426    }
    14271427  }
  • trunk/BNC/src/RTCM3/RTCM3coDecoder.h

    r11074 r11185  
    3131#include <QMap>
    3232#include <QSet>
     33#include "bnclog.h"
    3334#include "GPSDecoder.h"
    3435#include "../RTCM3/clock_and_orbit/clock_orbit_igs.h"
    … …  
    6869  void newSatAntennas(QList<t_satAntenna>);
    6970  void newMessage(QByteArray msg, bool showOnScreen);
     71  void newLogRecord(t_logRecord rec, bool showOnScreen);
    7072  void providerIDChanged(QString staID);
    7173
  • trunk/BNC/src/bnccaster.cpp

    r11021 r11185  
    6464  bncSettings settings;
    6565
    66   connect(this, SIGNAL(newMessage(QByteArray,bool)),
    67           BNC_CORE, SLOT(slotMessage(const QByteArray,bool)));
     66  BNC_CORE->connectMessages(this, "bnc");
     67  BNC_CORE->connectLogRecords(this, "bnc");
    6868
    6969  _outFile = 0;
    … …  
    8181                      + QByteArray::number(port) + ": "
    8282                      + _server->errorString();
    83       emit newMessage(message.toLatin1(), true);
     83      emit newLogRecord(t_logRecord::message(t_logRecord::error, message.toLatin1()), true);
    8484    }
    8585    connect(_server, SIGNAL(newConnection()), this, SLOT(slotNewConnection()));
    … …  
    9999                      + QByteArray::number(uPort) + ": "
    100100                      + _uServer->errorString();
    101       emit newMessage(message.toLatin1(), true);
     101      emit newLogRecord(t_logRecord::message(t_logRecord::error, message.toLatin1()), true);
    102102    }
    103103    connect(_uServer, SIGNAL(newConnection()), this, SLOT(slotNewUConnection()));
    … …  
    128128                      + QByteArray::number(_miscPort) + ": "
    129129                      + _miscServer->errorString();
    130       emit newMessage(message.toLatin1(), true);
     130      emit newLogRecord(t_logRecord::message(t_logRecord::error, message.toLatin1()), true);
    131131    }
    132132    connect(_miscServer, SIGNAL(newConnection()), this, SLOT(slotNewMiscConnection()));
    … …  
    235235        if ( !settings.value("outFile").toString().isEmpty() ||
    236236             !settings.value("outPort").toString().isEmpty() ) {
    237           emit( newMessage(QString("%1: Old or erroneous observation epoch %2 thrown away from %3")
     237          emit newLogRecord(t_logRecord::message(t_logRecord::warning, QString("%1: Old or erroneous observation epoch %2 thrown away from %3")
    238238                           .arg(staID.data())
    239239                           .arg(string(obs._time).c_str())
    240240                           .arg(obs._prn.toString().c_str())
    241                              .toLatin1(), true) );
     241                             .toLatin1()), true);
    242242        }
    243243      }
    … …  
    262262void bncCaster::slotNewConnection() {
    263263  _sockets->push_back( _server->nextPendingConnection() );
    264   emit( newMessage(QString("New client connection on sync port: # %1")
    265                    .arg(_sockets->size()).toLatin1(), true) );
     264  emit newLogRecord(t_logRecord::message(t_logRecord::info, QString("New client connection on sync port: # %1")
     265                   .arg(_sockets->size()).toLatin1()), true);
    266266}
    267267
    268268void bncCaster::slotNewUConnection() {
    269269  _uSockets->push_back( _uServer->nextPendingConnection() );
    270   emit( newMessage(QString("New client connection on usync port: # %1")
    271                    .arg(_uSockets->size()).toLatin1(), true) );
     270  emit newLogRecord(t_logRecord::message(t_logRecord::info, QString("New client connection on usync port: # %1")
     271                   .arg(_uSockets->size()).toLatin1()), true);
    272272}
    273273
    … …  
    318318  }
    319319  _staIDs.removeAll(staID);
    320   emit( newMessage(
    321            QString("Decoding %1 stream(s)").arg(_staIDs.size()).toLatin1(), true) );
     320  emit newLogRecord(t_logRecord::message(t_logRecord::info, QString("Decoding %1 stream(s)").arg(_staIDs.size()).toLatin1()), true);
    322321  if (_staIDs.size() == 0) {
    323322    emit getThreadsFinished();
    … …  
    482481
    483482  emit mountPointsRead(_threads);
    484   emit(newMessage(QString("Configuration read: " + BNC_CORE->confFileName() + ", %1 stream(s)").arg(_threads.count()).toLatin1(), true));
     483  emit newLogRecord(t_logRecord::message(t_logRecord::info, QString("Configuration read: " + BNC_CORE->confFileName() + ", %1 stream(s)").arg(_threads.count()).toLatin1()), true);
    485484
    486485  // (Re-) Start the configuration timer
    … …  
    586585void bncCaster::slotNewMiscConnection() {
    587586  _miscSockets->push_back( _miscServer->nextPendingConnection() );
    588   emit( newMessage(QString("New client connection on Miscellaneous Output Port: # %1")
    589                    .arg(_miscSockets->size()).toLatin1(), true) );
     587  emit newLogRecord(t_logRecord::message(t_logRecord::info, QString("New client connection on Miscellaneous Output Port: # %1")
     588                   .arg(_miscSockets->size()).toLatin1()), true);
    590589}
    591590
  • trunk/BNC/src/bnccaster.h

    r11021 r11185  
    3232#include <QNetworkProxy>
    3333
     34#include "bnclog.h"
    3435#include "satObs.h"
    3536#include "upload/bncrawuploadcaster.h"
    … …  
    5657   void getThreadsFinished();
    5758   void newMessage(QByteArray msg, bool showOnScreen);
     59   void newLogRecord(t_logRecord rec, bool showOnScreen);
    5860   void newObs(QByteArray staID, QList<t_satObs> obsList);
    5961
  • trunk/BNC/src/bnccore.cpp

    r11179 r11185  
    7373  _logFileStructured  = 0;
    7474  _logFormatStructured = t_logRecord::json;
     75  _logLevelStructured  = t_logRecord::debug;
    7576  _rawFile     = 0;
    7677  _caster      = 0;
    … …  
    149150  }
    150151  slotLogRecord(t_logRecord::fromMessage(msg), showOnScreen);
     152}
     153
     154// Write a Program Message of a component with an explicit level
     155////////////////////////////////////////////////////////////////////////////
     156void t_bncCore::message(const QByteArray& msg, bool showOnScreen, const QByteArray& component,
     157                        t_logRecord::e_level level) {
     158  if (msg.isEmpty()) {
     159    return;
     160  }
     161  slotLogRecord(t_logRecord::message(level, msg, component), showOnScreen);
     162}
     163
     164// Write a Program Message of a component
     165////////////////////////////////////////////////////////////////////////////
     166void t_bncCore::message(const QByteArray& msg, bool showOnScreen, const QByteArray& component) {
     167  if (msg.isEmpty()) {
     168    return;
     169  }
     170  slotLogRecord(t_logRecord::fromMessage(msg, component), showOnScreen);
    151171}
    152172
    … …  
    199219      _logFormatStructured = t_logRecord::formatFromString(
    200220                               settings.value("logFormatStructured").toString());
     221      _logLevelStructured  = t_logRecord::levelFromString(
     222                               settings.value("logLevelStructured").toString());
    201223      _logFileStructured = new QFile(structName + "_" + currDate.toString("yyMMdd"));
    202224      if (!_logFileStructured->open(append ? (QIODevice::WriteOnly | QIODevice::Append)
    … …  
    219241  }
    220242
    221   if (_logFileStructured) {
     243  if (_logFileStructured && rec._level >= _logLevelStructured) {
    222244    _logFileStructured->write(rec.encode(_logFormatStructured, currDateTime) + "\n");
    223245    _logFileStructured->flush();
    … …  
    232254#ifdef BNC_DEBUG_BCE
    233255  if (eph->checkState() == t_eph::unhealthy) {
    234     messagePrivate(t_logRecord::fromMessage(QString("%1: UNHEALTHY %2:%3")
     256    messagePrivate(t_logRecord::debugMessage("bce", QString("%1: UNHEALTHY %2:%3")
    235257                   .arg(eph->receptStaID())
    236258                   .arg(eph->typeStr(eph->type(), eph->prn(), 99.0))
    … …  
    238260  }
    239261  if (eph->checkState() == t_eph::bad) {
    240     messagePrivate(t_logRecord::fromMessage(QString("%1: WRONG %2:%3")
     262    messagePrivate(t_logRecord::debugMessage("bce", QString("%1: WRONG %2:%3")
    241263                   .arg(eph->receptStaID())
    242264                   .arg(eph->typeStr(eph->type(), eph->prn(), 99.0))
    … …  
    244266  }
    245267  if (eph->checkState() == t_eph::outdated) {
    246     messagePrivate(t_logRecord::fromMessage(QString("%1: OUTDATED %2:%3")
     268    messagePrivate(t_logRecord::debugMessage("bce", QString("%1: OUTDATED %2:%3")
    247269                   .arg(eph->receptStaID())
    248270                   .arg(eph->typeStr(eph->type(), eph->prn(), 99.0))
    … …  
    633655                      + QByteArray::number(_portEph) + ": "
    634656                      + _serverEph->errorString();
    635       slotMessage(message.toLatin1(), true);
     657      slotLogRecord(t_logRecord::message(t_logRecord::error, message.toLatin1(), "bnc"), true);
    636658    }
    637659    connect(_serverEph, SIGNAL(newConnection()), this, SLOT(slotNewConnectionEph()));
    … …  
    653675                      + QByteArray::number(_portCorr) + ": "
    654676                      + _serverCorr->errorString();
    655       slotMessage(message.toLatin1(), true);
     677      slotLogRecord(t_logRecord::message(t_logRecord::error, message.toLatin1(), "bnc"), true);
    656678    }
    657679    connect(_serverCorr, SIGNAL(newConnection()), this, SLOT(slotNewConnectionCorr()));
  • trunk/BNC/src/bnccore.h

    r11179 r11185  
    8686  int              sigintReceived;
    8787
     88  // Plain text message of a component (structured logfile, see bnclog.h),
     89  // level from keywords of the text or explicit
     90  void message(const QByteArray& msg, bool showOnScreen, const QByteArray& component);
     91  void message(const QByteArray& msg, bool showOnScreen, const QByteArray& component,
     92               t_logRecord::e_level level);
     93
     94  // Messages of an object with a signal newMessage(QByteArray,bool) as records
     95  // of the given component; same connection type as a connection to slotMessage
     96  template<class T> void connectMessages(T* sender, const char* component) {
     97    QByteArray comp(component);
     98    connect(sender, &T::newMessage, this, [this, comp](QByteArray msg, bool showOnScreen) {
     99      message(msg, showOnScreen, comp);
     100    });
     101  }
     102
     103  // Records of an object with a signal newLogRecord(t_logRecord,bool); an empty
     104  // component is set to the given one
     105  template<class T> void connectLogRecords(T* sender, const char* component) {
     106    QByteArray comp(component);
     107    connect(sender, &T::newLogRecord, this, [this, comp](t_logRecord rec, bool showOnScreen) {
     108      if (rec._component.isEmpty()) {
     109        rec._component = comp;
     110      }
     111      slotLogRecord(rec, showOnScreen);
     112    });
     113  }
     114
    88115  QMap<int, bncTableItem*> _uploadTableItems;
    89116  QMap<int, bncTableItem*> _uploadEphTableItems;
    … …  
    163190  QFile*                 _logFileStructured;
    164191  t_logRecord::e_format  _logFormatStructured;
     192  t_logRecord::e_level   _logLevelStructured;
    165193  QMutex                 _mutex;
    166194  QMutex                 _mutexMessage;
  • trunk/BNC/src/bnccredentials.cpp

    r11160 r11185  
    5151
    5252// Log a message once per key
    53 void message(const QString& key, const QString& msg) {
     53void message(const QString& key, const QString& msg, t_logRecord::e_level level) {
    5454  if (!_reported.contains(key)) {
    5555    _reported.insert(key);
    56     BNC_CORE->slotMessage(msg.toLatin1(), true);
     56    BNC_CORE->message(msg.toLatin1(), true, "ntrip", level);
    5757  }
    5858}
    … …  
    180180      message(fileName + QString(":%1").arg(lineNumbers[iLine]),
    181181              QString("Credentials file %1, line %2: not <host> [<port>] <user> <password>, ignored")
    182               .arg(fileName).arg(lineNumbers[iLine]));
     182              .arg(fileName).arg(lineNumbers[iLine]), t_logRecord::warning);
    183183    }
    184184  }
    … …  
    205205    file.refused = true;
    206206    message("perm:" + fileName,
    207             QString("Credentials file %1 is readable for other users, not used (chmod 600)").arg(fileName));
     207            QString("Credentials file %1 is readable for other users, not used (chmod 600)").arg(fileName),
     208            t_logRecord::warning);
    208209    return file;
    209210  }
    … …  
    212213  QFile inp(fileName);
    213214  if (!inp.open(QIODevice::ReadOnly | QIODevice::Text)) {
    214     message("open:" + fileName, QString("Cannot read credentials file %1").arg(fileName));
     215    message("open:" + fileName, QString("Cannot read credentials file %1").arg(fileName),
     216            t_logRecord::error);
    215217    return file;
    216218  }
    … …  
    332334      message("config:" + account,
    333335              QString("%1: password in the configuration file, it can be moved to a credentials file "
    334                       "(option 'credentialsFile', default ~/.netrc)").arg(account));
     336                      "(option 'credentialsFile', default ~/.netrc)").arg(account),
     337              t_logRecord::info);
    335338    }
    336339    return;
    … …  
    342345    QMutexLocker locker(&_mutex);
    343346    message("none:" + account, QString("%1: no password in the configuration file nor in %2")
    344             .arg(account).arg(fileNames().join(", ")));
    345   }
    346 }
     347            .arg(account).arg(fileNames().join(", ")), t_logRecord::warning);
     348  }
     349}
  • trunk/BNC/src/bncephuser.cpp

    r11140 r11185  
    7575                                                            Qt::SkipEmptyParts);
    7676  if (!_ephMounts.isEmpty()) {
    77     BNC_CORE->slotMessage((user.trimmed() + ": ephemerides of " + _ephMounts.join(", ") + " only").toLatin1(), true);
     77    BNC_CORE->message((user.trimmed() + ": ephemerides of " + _ephMounts.join(", ") + " only").toLatin1(), true, "bce", t_logRecord::info);
    7878  }
    7979}
  • trunk/BNC/src/bncgetthread.cpp

    r11179 r11185  
    129129  setTerminationEnabled(true);
    130130
    131   connect(this, SIGNAL(newMessage(QByteArray,bool)),
    132   BNC_CORE, SLOT(slotMessage(const QByteArray,bool)));
    133   connect(this, SIGNAL(newLogRecord(t_logRecord,bool)),
    134   BNC_CORE, SLOT(slotLogRecord(t_logRecord,bool)));
    135   t_logRecord::registerStation(_staID);
     131  BNC_CORE->connectMessages(this, "stream");
     132  BNC_CORE->connectLogRecords(this, "stream");
     133  t_logRecord::registerStream(_staID);
    136134
    137135  _isToBeDeleted = false;
    … …  
    162160                      + QByteArray::number(nmeaPort) + ": "
    163161                      + _nmeaServer->errorString();
    164       emit newMessage(message.toLatin1(), true);
     162      emit newLogRecord(t_logRecord::message(t_logRecord::error, message.toLatin1()), true);
    165163    }
    166164    else {
    … …  
    264262    msleep(100); //sleep 0.1 sec
    265263    if (!_serialPort->isOpen()) {
    266       emit(newMessage(_staID + ": Cannot open serial port " + portString.toLatin1()
    267            + ": " + _serialPort->errorString().toLatin1(), true));
     264      emit newLogRecord(t_logRecord::message(t_logRecord::error, _staID + ": Cannot open serial port " + portString.toLatin1()
     265           + ": " + _serialPort->errorString().toLatin1()), true);
    268266      delete _serialPort;
    269267      _serialPort = 0;
    270268    }
    271269    else {
    272       emit(newMessage(_staID + ": Serial port " + portString.toLatin1()
    273            + "is connected: " + _serialPort->errorString().toLatin1(), true));
     270      emit newLogRecord(t_logRecord::message(t_logRecord::info, _staID + ": Serial port " + portString.toLatin1()
     271           + "is connected: " + _serialPort->errorString().toLatin1()), true);
    274272      connect(_serialPort, SIGNAL(readyRead()), this, SLOT(slotSerialReadyRead()));
    275273    }
    … …  
    343341    connect((RTCM3Decoder*) newDecoder, SIGNAL(newMessage(QByteArray,bool)),
    344342        this, SIGNAL(newMessage(QByteArray,bool)));
     343    connect((RTCM3Decoder*) newDecoder, SIGNAL(newLogRecord(t_logRecord,bool)),
     344        this, SIGNAL(newLogRecord(t_logRecord,bool)));
    345345  } else if (_format == "ZERO") {
    346346    emitFormat(": Forward data in original format", "ZERO");
    … …  
    355355    _decoder = new bncRtnetDecoder();
    356356  } else {
    357     emit(newMessage(_staID + ": Unknown data format " + _format + ". Please change the format entry to ZERO or ZERO2FILE to forward unchanged data.", true));
     357    emit newLogRecord(t_logRecord::message(t_logRecord::error, _staID + ": Unknown data format " + _format + ". Please change the format entry to ZERO or ZERO2FILE to forward unchanged data."), true);
    358358    _isToBeDeleted = true;
    359359    return failure;
    … …  
    449449    try {
    450450      if (_isToBeDeleted) {
    451         emit(newMessage(_staID + ": is to be deleted", true));
     451        emit newLogRecord(t_logRecord::message(t_logRecord::info, _staID + ": is to be deleted"), true);
    452452        QThread::exit(4);
    453453        this->deleteLater();
    … …  
    484484        _format = _rawFile->format();
    485485        _staID = _rawFile->staID();
    486         t_logRecord::registerStation(_staID);
     486        t_logRecord::registerStream(_staID);
    487487
    488488        QCoreApplication::processEvents();
    489489
    490490        if (data.isEmpty() || BNC_CORE->sigintReceived) {
    491           emit(newMessage("No more data or SIGINT/SIGTERM received", true));
     491          emit newLogRecord(t_logRecord::message(t_logRecord::info, "No more data or SIGINT/SIGTERM received"), true);
    492492          // pass on data the decoders still hold back (last epoch)
    493493          QMapIterator<QString, GPSDecoder*> itFlush(_decodersRaw);
    … …  
    652652            QString prn(obs._prn.toString().c_str());
    653653            QString type = QString("%1").arg(obs._type);
    654             emit(newMessage(_staID + " (" + prn.toLatin1() + ")" + ": Wrong observation epoch(s)" + "( MT: " + type.toLatin1() + ")", false));
     654            emit newLogRecord(t_logRecord::message(t_logRecord::warning, _staID + " (" + prn.toLatin1() + ")" + ": Wrong observation epoch(s)" + "( MT: " + type.toLatin1() + ")"), false);
    655655            continue;
    656656          }
    … …  
    666666            bncTime oldTime = it.value();
    667667            if (obsTime < oldTime) {
    668               emit(newMessage(_staID + ": old observation " + prn.toLatin1(), false));
     668              emit newLogRecord(t_logRecord::message(t_logRecord::warning, _staID + ": old observation " + prn.toLatin1()), false);
    669669              continue;
    670670            } else if (obsTime == oldTime) {
    671               emit(newMessage(_staID + ": observation coming more than once " + prn.toLatin1(), false));
     671              emit newLogRecord(t_logRecord::message(t_logRecord::warning, _staID + ": observation coming more than once " + prn.toLatin1()), false);
    672672              continue;
    673673            }
    … …  
    691691    }
    692692    catch (Exception& exc) {
    693       emit(newMessage(_staID + " " + exc.what(), true));
     693      emit newLogRecord(t_logRecord::message(t_logRecord::error, _staID + " " + exc.what()), true);
    694694      _isToBeDeleted = true;
    695695    }
    696696    catch (std::exception& exc) {
    697       emit(newMessage(_staID + " " + exc.what(), true));
     697      emit newLogRecord(t_logRecord::message(t_logRecord::error, _staID + " " + exc.what()), true);
    698698      _isToBeDeleted = true;
    699699    }
    700700    catch (const string& error) {
    701       emit(newMessage(_staID + " ERROR: " + error.c_str(), true));
     701      emit newLogRecord(t_logRecord::message(t_logRecord::error, _staID + " ERROR: " + error.c_str()), true);
    702702      _isToBeDeleted = true;
    703703    }
    704704    catch (const char* error) {
    705       emit(newMessage(_staID + " ERROR: " + error, true));
     705      emit newLogRecord(t_logRecord::message(t_logRecord::error, _staID + " ERROR: " + error), true);
    706706      _isToBeDeleted = true;
    707707    }
    708708    catch (QString error) {
    709       emit(newMessage(_staID + " ERROR: " + error.toStdString().c_str(), true));
     709      emit newLogRecord(t_logRecord::message(t_logRecord::error, _staID + " ERROR: " + error.toStdString().c_str()), true);
    710710      _isToBeDeleted = true;
    711711    }
    712712    catch (...) {
    713       emit(newMessage(_staID + " bncGetThread: unknown exception", true));
     713      emit newLogRecord(t_logRecord::message(t_logRecord::error, _staID + " bncGetThread: unknown exception"), true);
    714714      _isToBeDeleted = true;
    715715    }
    … …  
    838838        QString type = QString("%1 ").arg(decoder()->_typeList[ii]._type);
    839839        QString size = (decoder()->_typeList[ii]._size) ? QString("(size %1)").arg(decoder()->_typeList[ii]._size) : "";
    840         emit(newMessage(_staID + ": Received message type " + type.toLatin1() +  size.toLatin1(), true));
     840        t_logRecord rec(t_logRecord::info, "stream", "stream_content", _staID,
     841                        _staID + ": Received message type " + type.toLatin1() +  size.toLatin1());
     842        rec.add("message_type", int(decoder()->_typeList[ii]._type));
     843        if (decoder()->_typeList[ii]._size) {
     844          rec.add("size", int(decoder()->_typeList[ii]._size));
     845        }
     846        emit newLogRecord(rec, true);
    841847      }
    842848
    … …  
    908914            str << " " << rnxTypes[iType];
    909915          }
    910           emit(newMessage(_staID + ": Observation Types: " + msg.toLatin1(),  true));
     916          emitContent(_staID + ": Observation Types: " + msg.toLatin1(),  true);
    911917        }
    912918      }
    … …  
    916922      for (int ii = 0; ii < decoder()->_antType.size(); ii++) {
    917923        QString ant1 = QString(": Antenna Descriptor: %1 ").arg(decoder()->_antType[ii]._descriptor);
    918         emit(newMessage(_staID + ant1.toLatin1(), true));
     924        emitContent(_staID + ant1.toLatin1(), true);
    919925        if (strlen(decoder()->_antType[ii]._serialnumber)) {
    920926          QString ant2 = QString(": Antenna Serial Number: %1 ").arg(decoder()->_antType[ii]._serialnumber);
    921           emit(newMessage(_staID + ant2.toLatin1(), true));
     927          emitContent(_staID + ant2.toLatin1(), true);
    922928        }
    923929      }
    … …  
    936942        ant2 = QString("%1 ").arg(decoder()->_antList[ii]._yy, 0, 'f', 4).toLatin1();
    937943        ant3 = QString("%1 ").arg(decoder()->_antList[ii]._zz, 0, 'f', 4).toLatin1();
    938         emit(newMessage(_staID + ": " + antT + " (ITRF) X " + ant1 + "m", true));
    939         emit(newMessage(_staID + ": " + antT + " (ITRF) Y " + ant2 + "m", true));
    940         emit(newMessage(_staID + ": " + antT + " (ITRF) Z " + ant3 + "m", true));
     944        emitContent(_staID + ": " + antT + " (ITRF) X " + ant1 + "m", true);
     945        emitContent(_staID + ": " + antT + " (ITRF) Y " + ant2 + "m", true);
     946        emitContent(_staID + ": " + antT + " (ITRF) Z " + ant3 + "m", true);
    941947        double hh = 0.0;
    942948        if (decoder()->_antList[ii]._height_f) {
    943949          hh = decoder()->_antList[ii]._height;
    944950          QByteArray ant4 = QString("%1 ").arg(hh, 0, 'f', 4).toLatin1();
    945           emit(newMessage(
    946               _staID + ": Antenna height above marker " + ant4 + "m", true));
     951          emitContent(
     952              _staID + ": Antenna height above marker " + ant4 + "m", true);
    947953        }
    948954        emit(newAntCrd(_staID, decoder()->_antList[ii]._xx,
    … …  
    956962        QString rec2 = QString(": Receiver Firmware Version: %1 ").arg(decoder()->_recType[ii]._firmware);
    957963        QString rec3 = QString(": Receiver Serial Number: %1 ").arg(decoder()->_recType[ii]._serialnumber);
    958         emit(newMessage(_staID + rec1.toLatin1(), true));
    959         emit(newMessage(_staID + rec2.toLatin1(), true));
    960         emit(newMessage(_staID + rec3.toLatin1(), true));
     964        emitContent(_staID + rec1.toLatin1(), true);
     965        emitContent(_staID + rec2.toLatin1(), true);
     966        emitContent(_staID + rec3.toLatin1(), true);
    961967      }
    962968
    … …  
    973979        if (!allFound) {
    974980          _gloSlots.sort();
    975           emit(newMessage(
     981          emitContent(
    976982              _staID + ": GLONASS Slot:Freq " + _gloSlots.join(" ").toLatin1(),
    977               true));
     983              true);
    978984        }
    979985      }
    … …  
    983989      if (decoder()->_gloBiasInfo.changed()) {
    984990        QString gloCodePhaseBiases = decoder()->_gloBiasInfo.toString();
    985         emit(newMessage(_staID + gloCodePhaseBiases.toLatin1(), true));
     991        emitContent(_staID + gloCodePhaseBiases.toLatin1(), true);
    986992        decoder()->_gloBiasInfo.setChanged(false);
    987993      }
    … …  
    9951001          QString coordinateEpoch = QString(": Service CRS Coordinate Epoch: %1 ").arg(decoder()->_serviceCrs[ii]._coordinateEpoch);
    9961002          //QString ce = QString(": CE: %1 ").arg(decoder()->_serviceCrs[ii]._CE);
    997           emit(newMessage(_staID + servicecrsname.toLatin1(), true));
    998           emit(newMessage(_staID + coordinateEpoch.toLatin1(), true));
    999           //emit(newMessage(_staID + ce.toLatin1(), true));
     1003          emitContent(_staID + servicecrsname.toLatin1(), true);
     1004          emitContent(_staID + coordinateEpoch.toLatin1(), true);
     1005          //emitContent(_staID + ce.toLatin1(), true);
    10001006        }
    10011007        // RTCM CRS
    … …  
    10041010          QString anchor      = QString(": RTCM CRS Anchor: %1 ").arg(decoder()->_rtcmCrs[ii]._anchor);
    10051011          QString platenumber = QString(": RTCM CRS Plate Number: %1 ").arg(decoder()->_rtcmCrs[ii]._plateNumber);
    1006           emit(newMessage(_staID + rtcmcrsname.toLatin1(), true));
    1007           emit(newMessage(_staID + anchor.toLatin1(), true));
    1008           emit(newMessage(_staID + platenumber.toLatin1(), true));
     1012          emitContent(_staID + rtcmcrsname.toLatin1(), true);
     1013          emitContent(_staID + anchor.toLatin1(), true);
     1014          emitContent(_staID + platenumber.toLatin1(), true);
    10091015          for (int i = 0; i<decoder()->_rtcmCrs[ii]._databaseLinks.size(); i++) {
    10101016            QString dblink = QString(": Database Link: %1 ").arg(decoder()->_rtcmCrs[ii]._databaseLinks[i]);
    1011             emit(newMessage(_staID + dblink.toLatin1(), true));
     1017            emitContent(_staID + dblink.toLatin1(), true);
    10121018          }
    10131019        }
    … …  
    10301036              .arg(helmertPar._oxr).arg(helmertPar._oyr).arg(helmertPar._ozr);
    10311037          QString parscale = QString(": MT1301 Helmert Par Scale: sc = %1, scr = %2").arg(helmertPar._sc).arg(helmertPar._scr);
    1032           emit(newMessage(_staID + sourcename.toLatin1(), true));
    1033           emit(newMessage(_staID + targetname.toLatin1(), true));
    1034           emit(newMessage(_staID + sysidentnum.toLatin1(), true));
    1035           emit(newMessage(_staID + trafomessageind.toLatin1(), true));
    1036           emit(newMessage(_staID + epoch.toLatin1(), true));
    1037           emit(newMessage(_staID + partrans.toLatin1(), true));
    1038           emit(newMessage(_staID + parrot.toLatin1(), true));
    1039           emit(newMessage(_staID + parscale.toLatin1(), true));
     1038          emitContent(_staID + sourcename.toLatin1(), true);
     1039          emitContent(_staID + targetname.toLatin1(), true);
     1040          emitContent(_staID + sysidentnum.toLatin1(), true);
     1041          emitContent(_staID + trafomessageind.toLatin1(), true);
     1042          emitContent(_staID + epoch.toLatin1(), true);
     1043          emitContent(_staID + partrans.toLatin1(), true);
     1044          emitContent(_staID + parrot.toLatin1(), true);
     1045          emitContent(_staID + parscale.toLatin1(), true);
    10401046        }
    10411047      }
    … …  
    11241130void bncGetThread::slotNewNMEAConnection() {
    11251131  _nmeaSockets->push_back(_nmeaServer->nextPendingConnection());
    1126   emit(newMessage(
    1127       QString("New PPP client on port: # %1").arg(_nmeaSockets->size()).toLatin1(),
    1128       true));
     1132  emit newLogRecord(t_logRecord::message(t_logRecord::info, QString("New PPP client on port: # %1").arg(_nmeaSockets->size()).toLatin1()), true);
    11291133}
    11301134
    … …  
    11571161  emit newLogRecord(rec, true);
    11581162}
     1163
     1164// Content of the stream found by the RTCM scan (miscScanRTCM)
     1165////////////////////////////////////////////////////////////////////////////
     1166void bncGetThread::emitContent(const QByteArray& msg, bool showOnScreen) {
     1167  emit newLogRecord(t_logRecord(t_logRecord::info, "stream", "stream_content", _staID, msg),
     1168                    showOnScreen);
     1169}
  • trunk/BNC/src/bncgetthread.h

    r11179 r11185  
    103103   t_irc        initDecoder();
    104104   void         emitFormat(const char* text, const char* decoder);
     105   void         emitContent(const QByteArray& msg, bool showOnScreen);
    105106   GPSDecoder* decoder();
    106107
  • trunk/BNC/src/bnchelp.html

    r11179 r11185  
    27892789    'json' for one JSON object per line (JSON Lines) or 'logfmt' for key=value pairs separated by blanks. As for the
    27902790    logfile, the name is extended by '_YYMMDD'. The logfile itself remains unchanged, so existing scripts reading it
    2791     keep working. Default is an empty option field, meaning that no structured logfile is written.
     2791    keep working. Default is an empty option field, meaning that no structured logfile is written. 'Min. level'
     2792    restricts the structured logfile to records of at least the selected level: 'debug' (default) writes all records,
     2793    'info' leaves out the debug records, 'warning' writes warnings and errors, 'error' errors only.
    27922794  </p>
    27932795  <p>
    … …  
    27972799    <li>'time': time of the record in UTC, ISO 8601 with 'Z', e.g. '2025-11-17T13:49:40.000Z',</li>
    27982800    <li>'gpst': the same time in GPS Time (as the time stamps of the logfile), e.g. '2025-11-17T13:49:58.000',</li>
    2799     <li>'level': 'info', 'warning' or 'error',</li>
    2800     <li>'component': the part of BNC writing the record, e.g. 'stream', 'ppp', or 'bnc' for general messages,</li>
     2801    <li>'level': 'debug', 'info', 'warning' or 'error'; debug records exist only in BNC versions built with the
     2802        defines BNC_DEBUG_BCE, BNC_DEBUG_OBS or BNC_DEBUG_CMB (src/src.pri),</li>
     2803    <li>'component': the part of BNC writing the record: 'stream' (stream retrieval and decoding, latency, outages,
     2804        RTCM scan, raw file input), 'ntrip' (Ntrip and UDP/RTP queries, credentials), 'obs' (observation decoding,
     2805        debug), 'bce' (broadcast ephemerides), 'ssr' (SSR decoding), 'ppp', 'cmb' (combination), 'upload', 'ssrqc'
     2806        (SSR QC), or 'bnc' for general messages,</li>
    28012807    <li>'event': the kind of record, see below, or 'message' for general messages,</li>
    2802     <li>'station': the stream or PPP station, if known,</li>
     2808    <li>'stream': the stream (mountpoint) or the PPP station, if known,</li>
    28032809    <li>the fields of the event,</li>
    28042810    <li>'msg': the text of the record in the logfile,</li>
    … …  
    28132819    <li>'stream_format': 'decoder' (RTCM2, RTCM3, ZERO, ZERO2FILE, RTNET) and 'format' (format entry of the stream),</li>
    28142820    <li>'stream_timeout' (warning): data timeout, BNC reconnects,</li>
     2821    <li>'stream_content': content of the stream found by the RTCM scan (see section <a href=#miscscan>2.12.3</a>), e.g. observation
     2822        types, antenna and receiver descriptors, antenna coordinates, GLONASS slots, CRS and Helmert parameters; for the
     2823        received message types with the fields 'message_type' and, if known, 'size' (bytes),</li>
    28152824    <li>'stream_outage_begin' (warning), 'stream_corrupted_begin' (warning): 'since' (UTC);
    28162825        'stream_outage_end', 'stream_corrupted_end': 'ended' and 'since' (UTC),</li>
    … …  
    28192828  </ul>
    28202829  <p>
    2821     All other messages are written with component 'bnc' and event 'message'. Their level is derived from keywords of
    2822     the text ('error', 'fail', 'cannot', ... give 'error'; 'warning', 'outage', 'corrupt', 'timeout', 'wrong',
    2823     'invalid', 'ignored', 'unknown', ... give 'warning'). Further events will follow; new keys may be added to a record
     2830    All other messages are written with event 'message' and the component of their origin; the messages of the
     2831    BNC_DEBUG_* defines with level 'debug'. The levels mean: 'error' - a function does not work (e.g. stream,
     2832    upload or PPP not possible, a file cannot be read, BNC exits); 'warning' - a data or configuration problem,
     2833    BNC continues (e.g. data dropped, reconnect, default used, AC or satellite excluded from the combination);
     2834    'info' - status. Further events will follow; new keys may be added to a record
    28242835    without changing its version, removed or renamed keys increase the version.
    28252836  </p>
    … …  
    28282839  </p>
    28292840  <pre><p style="font-family:Monospace">
    2830 {"time":"2025-11-17T13:48:51.000Z","gpst":"2025-11-17T13:49:09.000","level":"info","component":"stream","event":"stream_format","station":"BCEP00BKG0","decoder":"RTCM3","format":"RTCM_3.3","msg":"BCEP00BKG0: Get data in RTCM 3.x format","v":1}
    2831 {"time":"2025-11-17T13:49:40.000Z","gpst":"2025-11-17T13:49:58.000","level":"info","component":"ppp","event":"ppp_position","station":"WTZR00DEU0","epoch":"2025-11-17T13:49:10.000","x":4075580.2172,"y":931854.1555,"z":4801568.3403,"dn":0.0000,"de":0.0000,"du":0.0001,"trp0":2.1833,"trp":0.0019,"trp_stdev":0.0993,"num_sat":17,"hdop":0.59,"fixed":false,"fix_percent":0,"msg":"2025-11-17_13:49:10.000 WTZR00DEU0 X = 4075580.2172 ...","v":1}
     2841{"time":"2025-11-17T13:48:51.000Z","gpst":"2025-11-17T13:49:09.000","level":"info","component":"stream","event":"stream_format","stream":"BCEP00BKG0","decoder":"RTCM3","format":"RTCM_3.3","msg":"BCEP00BKG0: Get data in RTCM 3.x format","v":1}
     2842{"time":"2025-11-17T13:49:40.000Z","gpst":"2025-11-17T13:49:58.000","level":"info","component":"ppp","event":"ppp_position","stream":"WTZR00DEU0","epoch":"2025-11-17T13:49:10.000","x":4075580.2172,"y":931854.1555,"z":4801568.3403,"dn":0.0000,"de":0.0000,"du":0.0001,"trp0":2.1833,"trp":0.0019,"trp_stdev":0.0993,"num_sat":17,"hdop":0.59,"fixed":false,"fix_percent":0,"msg":"2025-11-17_13:49:10.000 WTZR00DEU0 X = 4075580.2172 ...","v":1}
    28322843</pre>
    28332844  </p>
    … …  
    28362847  </p>
    28372848  <pre><p style="font-family:Monospace">
    2838 time=2025-11-17T13:48:51.000Z gpst=2025-11-17T13:49:09.000 level=info component=stream event=stream_format station=BCEP00BKG0 decoder=RTCM3 format=RTCM_3.3 msg="BCEP00BKG0: Get data in RTCM 3.x format" v=1
    2839 time=2025-11-17T13:49:40.000Z gpst=2025-11-17T13:49:58.000 level=info component=ppp event=ppp_position station=WTZR00DEU0 epoch=2025-11-17T13:49:10.000 x=4075580.2172 y=931854.1555 z=4801568.3403 dn=0.0000 de=0.0000 du=0.0001 trp0=2.1833 trp=0.0019 trp_stdev=0.0993 num_sat=17 hdop=0.59 fixed=false fix_percent=0 msg="2025-11-17_13:49:10.000 WTZR00DEU0 X = 4075580.2172 ..." v=1
     2849time=2025-11-17T13:48:51.000Z gpst=2025-11-17T13:49:09.000 level=info component=stream event=stream_format stream=BCEP00BKG0 decoder=RTCM3 format=RTCM_3.3 msg="BCEP00BKG0: Get data in RTCM 3.x format" v=1
     2850time=2025-11-17T13:49:40.000Z gpst=2025-11-17T13:49:58.000 level=info component=ppp event=ppp_position stream=WTZR00DEU0 epoch=2025-11-17T13:49:10.000 x=4075580.2172 y=931854.1555 z=4801568.3403 dn=0.0000 de=0.0000 du=0.0001 trp0=2.1833 trp=0.0019 trp_stdev=0.0993 num_sat=17 hdop=0.59 fixed=false fix_percent=0 msg="2025-11-17_13:49:10.000 WTZR00DEU0 X = 4075580.2172 ..." v=1
    28402851</pre>
    28412852  </p>
    … …  
    1114811159   logFileStructured {Structured logfile in addition to the logfile, full path [character string]}
    1114911160   logFormatStructured {Format of the structured logfile [character string: json|logfmt]}
     11161   logLevelStructured {Minimum level of the records in the structured logfile [character string: debug|info|warning|error]}
    1115011162   rnxAppend        {Append files [integer number: 0=no,2=yes]}
    1115111163   onTheFlyInterval {Configuration reload interval [character string: no|1 day|1 hour|5 min|1 min]}
  • trunk/BNC/src/bnclog.cpp

    r11179 r11185  
    2424namespace {
    2525
    26 QMutex          stationMutex;
    27 QSet<QByteArray> stations;
     26QMutex          streamMutex;
     27QSet<QByteArray> streams;
    2828
    2929// text as UTF-8 (BNC's messages are Latin-1)
    … …  
    9797// Envelope of a plain text message
    9898////////////////////////////////////////////////////////////////////////////
    99 t_logRecord t_logRecord::fromMessage(const QByteArray& msg) {
    100   t_logRecord rec(info, "bnc", "message", "", msg);
    101 
    102   // station: first token of the text, if it is a known station name
     99t_logRecord t_logRecord::fromMessage(const QByteArray& msg, const QByteArray& component) {
     100  t_logRecord rec(info, component, "message", "", msg);
     101
     102  // stream: first token of the text, if it is a known stream or PPP station
    103103  int end = 0;
    104104  while (end < msg.size() && msg[end] != ':' && msg[end] != ' ' && msg[end] != '(') {
    … …  
    107107  if (end > 0) {
    108108    QByteArray token = msg.left(end);
    109     QMutexLocker locker(&stationMutex);
    110     if (stations.contains(token)) {
    111       rec._station = token;
     109    QMutexLocker locker(&streamMutex);
     110    if (streams.contains(token)) {
     111      rec._stream = token;
    112112    }
    113113  }
    … …  
    136136}
    137137
     138// Plain text message with an explicit level
     139////////////////////////////////////////////////////////////////////////////
     140t_logRecord t_logRecord::message(e_level level, const QByteArray& msg,
     141                                 const QByteArray& component) {
     142  t_logRecord rec = fromMessage(msg, component);
     143  rec._level = level;
     144  return rec;
     145}
     146
     147// Message of a BNC_DEBUG_* build
     148////////////////////////////////////////////////////////////////////////////
     149t_logRecord t_logRecord::debugMessage(const QByteArray& component, const QByteArray& msg) {
     150  t_logRecord rec = fromMessage(msg, component);
     151  rec._level = debug;
     152  return rec;
     153}
     154
    138155//
    139156////////////////////////////////////////////////////////////////////////////
    … …  
    196213const char* t_logRecord::levelString(e_level level) {
    197214  switch (level) {
     215    case debug:   return "debug";
    198216    case warning: return "warning";
    199217    case error:   return "error";
    … …  
    210228//
    211229////////////////////////////////////////////////////////////////////////////
    212 void t_logRecord::registerStation(const QByteArray& station) {
    213   if (station.isEmpty()) {
     230t_logRecord::e_level t_logRecord::levelFromString(const QString& str) {
     231  QString ss = str.trimmed().toLower();
     232  if (ss == "info")    return info;
     233  if (ss == "warning") return warning;
     234  if (ss == "error")   return error;
     235  return debug;
     236}
     237
     238//
     239////////////////////////////////////////////////////////////////////////////
     240void t_logRecord::registerStream(const QByteArray& stream) {
     241  if (stream.isEmpty()) {
    214242    return;
    215243  }
    216   QMutexLocker locker(&stationMutex);
    217   stations.insert(station);
     244  QMutexLocker locker(&streamMutex);
     245  streams.insert(stream);
    218246}
    219247
    … …  
    242270  put("component", _component, true);
    243271  put("event",     _event, true);
    244   if (!_station.isEmpty()) {
    245     put("station", _station, true);
     272  if (!_stream.isEmpty()) {
     273    put("stream", _stream, true);
    246274  }
    247275  all += _fields;
  • trunk/BNC/src/bnclog.h

    r11179 r11185  
    3636// logfile gets one line per record, JSON (JSON Lines) or logfmt:
    3737//
    38 //   time gpst level component event [station] [fields ...] msg v
     38//   time gpst level component event [stream] [fields ...] msg v
    3939//
    4040// Messages that are still emitted as plain text (newMessage(QByteArray,bool))
    41 // become records with component "bnc" and event "message"; the station is
     41// become records with event "message" and the component of their sender
     42// (t_bncCore::connectMessages(), default "bnc"); the stream is
    4243// taken from the text prefix if it is a known stream or PPP station, the
    4344// level from keywords of the text (fromMessage()).
    … …  
    4546class t_logRecord {
    4647 public:
    47   enum e_level {info, warning, error};
     48  enum e_level {debug, info, warning, error};   // increasing severity
    4849  enum e_format {json, logfmt};
    4950
    … …  
    5354  t_logRecord() : _level(info) {}
    5455  t_logRecord(e_level level, const QByteArray& component, const QByteArray& event,
    55               const QByteArray& station, const QByteArray& msg)
    56     : _level(level), _component(component), _event(event), _station(station), _msg(msg) {}
     56              const QByteArray& stream, const QByteArray& msg)
     57    : _level(level), _component(component), _event(event), _stream(stream), _msg(msg) {}
    5758
    5859  // envelope of a plain text message
    59   static t_logRecord fromMessage(const QByteArray& msg);
     60  static t_logRecord fromMessage(const QByteArray& msg, const QByteArray& component = "bnc");
     61
     62  // plain text message with an explicit level, event "message"; an empty
     63  // component is filled by the connection (t_bncCore::connectLogRecords())
     64  static t_logRecord message(e_level level, const QByteArray& msg,
     65                             const QByteArray& component = QByteArray());
     66
     67  // message of a BNC_DEBUG_* build: level debug, event "message"
     68  static t_logRecord debugMessage(const QByteArray& component, const QByteArray& msg);
    6069
    6170  // fields in the order added; numbers are written with the C locale
    … …  
    7079
    7180  static e_format formatFromString(const QString& str);
     81  static e_level  levelFromString(const QString& str);       // default debug
    7282  static const char* levelString(e_level level);
    7383
    74   // station names known for the prefix of plain text messages (thread safe)
    75   static void registerStation(const QByteArray& station);
     84  // stream (mountpoint) and PPP station names known for the prefix of plain
     85  // text messages (thread safe)
     86  static void registerStream(const QByteArray& stream);
    7687
    7788  e_level    _level;
    7889  QByteArray _component;
    7990  QByteArray _event;
    80   QByteArray _station;
     91  QByteArray _stream;
    8192  QByteArray _msg;
    8293
  • trunk/BNC/src/bncmain.cpp

    r11179 r11185  
    149149        "   logFileStructured {Structured logfile in addition to the logfile, full path [character string]}\n"
    150150        "   logFormatStructured {Format of the structured logfile [character string: json|logfmt]}\n"
     151        "   logLevelStructured {Minimum level of the records in the structured logfile [character string: debug|info|warning|error]}\n"
    151152        "   rnxAppend        {Append files [integer number: 0=no,2=yes]}\n"
    152153        "   onTheFlyInterval {Configuration reload interval [character string: no|1 day|1 hour|5 min|1 min]}\n"
    … …  
    450451#endif
    451452
    452 #ifdef Q_OS_MACX
    453     if (QSysInfo::MacintoshVersion > QSysInfo::MV_10_8)
    454     {
    455         // fix Mac OS X 10.9 (mavericks) font issue
    456         // https://bugreports.qt-project.org/browse/QTBUG-32789
    457         QFont::insertSubstitution(".Lucida Grande UI", "Lucida Grande");
    458     }
    459 #endif
    460 
    461453    bool GUIenabled = interactive || displaySet;
    462454    QScopedPointer<QCoreApplication> app(createApplication(argc, argv, GUIenabled));
    … …  
    575567        BNC_CORE->connect(caster, SIGNAL(getThreadsFinished()), app->instance(), SLOT(quit()));
    576568
    577         BNC_CORE->slotMessage("========== Start BNC v" BNCVERSION " (" BNC_OS ") ==========", true);
     569        BNC_CORE->message("========== Start BNC v" BNCVERSION " (" BNC_OS ") ==========", true, "bnc", t_logRecord::info);
    578570
    579571
    … …  
    586578            caster->readMountPoints();
    587579            if (caster->numStations() == 0) {
    588                 BNC_CORE->slotMessage("bncMain: number of caster stations: 0 => exit", true);
     580                BNC_CORE->message("bncMain: number of caster stations: 0 => exit", true, "bnc", t_logRecord::error);
    589581                exit(3);
    590582            }
  • trunk/BNC/src/bncnetquery.h

    r9719 r11185  
    55#include <QUrl>
    66
     7#include "bnclog.h"
    78#include "bncconst.h"
    89#include "bnccore.h"
    … …  
    1516
    1617  bncNetQuery() {
    17     connect(this,     SIGNAL(newMessage(QByteArray,bool)),
    18             BNC_CORE, SLOT(slotMessage(const QByteArray,bool)));
     18    BNC_CORE->connectMessages(this, "ntrip");
     19    BNC_CORE->connectLogRecords(this, "ntrip");
    1920  }
    2021  virtual ~bncNetQuery() {}
    … …  
    3435 signals:
    3536  void newMessage(QByteArray msg, bool showOnScreen);
     37  void newLogRecord(t_logRecord rec, bool showOnScreen);
    3638
    3739 private slots:
  • trunk/BNC/src/bncnetqueryrtp.cpp

    r11130 r11185  
    231231              while (!line.isEmpty() && ++nLines <= maxHeaderLines) {
    232232                if (line.indexOf("200 OK") != -1) {
    233                   emit newMessage(_url.toEncoded(QUrl::RemoveUserInfo).replace(0,1,"")
    234                             + ": UDP connection established", true);
     233                  emit newLogRecord(t_logRecord::message(t_logRecord::info, _url.toEncoded(QUrl::RemoveUserInfo).replace(0,1,"")
     234                            + ": UDP connection established"), true);
    235235                  slotKeepAlive();
    236236                  return;
    … …  
    248248  _socket = 0;
    249249  _status = error;
    250   emit newMessage(_url.toEncoded(QUrl::RemoveUserInfo).replace(0,1,"")
    251                   + ": NetQuery, waiting for connect", true);
     250  emit newLogRecord(t_logRecord::message(t_logRecord::info, _url.toEncoded(QUrl::RemoveUserInfo).replace(0,1,"")
     251                  + ": NetQuery, waiting for connect"), true);
    252252}
    253253
  • trunk/BNC/src/bncnetquerys.cpp

    r10778 r11185  
    191191
    192192  if (!_serialPort->isOpen()) {
    193     emit newMessage(_url.path().toLatin1().replace(0,1,"") + ": Cannot open serial port " + _portString.toLatin1()
    194                     + ": " + _serialPort->errorString().toLatin1(), true);
     193    emit newLogRecord(t_logRecord::message(t_logRecord::error, _url.path().toLatin1().replace(0,1,"") + ": Cannot open serial port " + _portString.toLatin1()
     194                    + ": " + _serialPort->errorString().toLatin1()), true);
    195195    delete _serialPort;
    196196    _serialPort = 0;
    … …  
    199199  }
    200200  else {
    201     emit(newMessage(_url.path().toLatin1().replace(0,1,"") + ": Serial port " + _portString.toLatin1()
    202                     + " is connected: " , true));
     201    emit newLogRecord(t_logRecord::message(t_logRecord::info, _url.path().toLatin1().replace(0,1,"") + ": Serial port " + _portString.toLatin1()
     202                    + " is connected: "), true);
    203203    _status = running;
    204204  }
  • trunk/BNC/src/bncnetqueryudp0.cpp

    r11128 r11185  
    100100      _senders = QHostInfo::fromName(host).addresses();
    101101      if (_senders.isEmpty()) {
    102         emit newMessage(url.path().toLatin1().replace(0,1,"") +
    103                         ": Cannot resolve UDP sender " + host.toLatin1(), true);
     102        emit newLogRecord(t_logRecord::message(t_logRecord::error, url.path().toLatin1().replace(0,1,"") +
     103                        ": Cannot resolve UDP sender " + host.toLatin1()), true);
    104104        _status = error;
    105105        return;
  • trunk/BNC/src/bncnetqueryv0.cpp

    r8204 r11185  
    6767        _socket = 0;
    6868        _status = error;
    69         emit newMessage(_url.path().toLatin1() + " read timeout", true);
     69        emit newLogRecord(t_logRecord::message(t_logRecord::warning, _url.path().toLatin1() + " read timeout"), true);
    7070        return;
    7171      }
    … …  
    102102    _socket = 0;
    103103    _status = error;
    104       emit(newMessage(_url.path().toLatin1().replace(0,1,"")
    105                       + ": Connect timeout, reconnecting", true));
     104      emit newLogRecord(t_logRecord::message(t_logRecord::warning, _url.path().toLatin1().replace(0,1,"")
     105                      + ": Connect timeout, reconnecting"), true);
    106106    return;
    107107  }
    … …  
    115115      _socket = 0;
    116116      _status = error;
    117       emit newMessage(_url.path().toLatin1().replace(0,1,"")
    118                       + ": Read timeout", true);
     117      emit newLogRecord(t_logRecord::message(t_logRecord::warning, _url.path().toLatin1().replace(0,1,"")
     118                      + ": Read timeout"), true);
    119119      return;
    120120    }
  • trunk/BNC/src/bncnetqueryv1.cpp

    r11130 r11185  
    9191        _socket = 0;
    9292        _status = error;
    93         emit newMessage(_url.path().toLatin1().replace(0,1,"")
    94                         + ": " + errStr.toLatin1(), true);
     93        emit newLogRecord(t_logRecord::message(t_logRecord::warning, _url.path().toLatin1().replace(0,1,"")
     94                        + ": " + errStr.toLatin1()), true);
    9595        return;
    9696      }
    … …  
    157157     _socket = 0;
    158158     _status = error;
    159      emit newMessage(_url.path().toLatin1().replace(0,1,"")
    160                      + ": Write timeout", true);
     159     emit newLogRecord(t_logRecord::message(t_logRecord::warning, _url.path().toLatin1().replace(0,1,"")
     160                     + ": Write timeout"), true);
    161161     return;
    162162   }
    … …  
    243243    _socket = 0;
    244244    _status = error;
    245     emit newMessage(_url.path().toLatin1().replace(0,1,"")
    246                     + ": Write timeout", true);
     245    emit newLogRecord(t_logRecord::message(t_logRecord::warning, _url.path().toLatin1().replace(0,1,"")
     246                    + ": Write timeout"), true);
    247247    return;
    248248  }
    … …  
    265265          _socket = 0;
    266266          _status = error;
    267           emit newMessage(_url.path().toLatin1().replace(0,1,"")
    268                           + ": Caster response header too long", true);
     267          emit newLogRecord(t_logRecord::message(t_logRecord::warning, _url.path().toLatin1().replace(0,1,"")
     268                          + ": Caster response header too long"), true);
    269269          return;
    270270        }
    … …  
    307307        _socket = 0;
    308308        _status = error;
    309         emit newMessage(_url.path().toLatin1().replace(0,1,"")
    310                         + ": Caster response header too long", true);
     309        emit newLogRecord(t_logRecord::message(t_logRecord::warning, _url.path().toLatin1().replace(0,1,"")
     310                        + ": Caster response header too long"), true);
    311311        return;
    312312      }
    … …  
    315315        _socket = 0;
    316316        _status = error;
    317         emit newMessage(_url.path().toLatin1().replace(0,1,"")
    318                         + ": Response timeout", true);
     317        emit newLogRecord(t_logRecord::message(t_logRecord::warning, _url.path().toLatin1().replace(0,1,"")
     318                        + ": Response timeout"), true);
    319319        return;
    320320      }
    … …  
    324324      _socket = 0;
    325325      _status = error;
    326       emit newMessage(_url.path().toLatin1().replace(0,1,"")
     326      emit newLogRecord(t_logRecord::message(t_logRecord::warning, _url.path().toLatin1().replace(0,1,"")
    327327                      + ": Wrong caster response\n"
    328                       + response.join("").toLatin1(), true);
     328                      + response.join("").toLatin1()), true);
    329329    }
    330330  }
  • trunk/BNC/src/bncnetqueryv2.cpp

    r11126 r11185  
    4343  if (_secure ) {
    4444    if (!QSslSocket::supportsSsl()) {
    45       BNC_CORE->slotMessage("No SSL support, install OpenSSL run-time libraries", true);
     45      BNC_CORE->message("No SSL support, install OpenSSL run-time libraries", true, "ntrip", t_logRecord::error);
    4646      stop();
    4747    }
    … …  
    8080    _status = error;
    8181    if (!_reply->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toByteArray().isEmpty()) {
    82     emit newMessage(_url.path().toLatin1().replace(0,1,"")  +
     82    emit newLogRecord(t_logRecord::message(t_logRecord::warning, _url.path().toLatin1().replace(0,1,"")  +
    8383                    ": NetQueryV2: server replied: " +
    84                     _reply->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toByteArray(),
    85                     true);
     84                    _reply->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toByteArray()), true);
    8685    } else {
    87       emit newMessage(_url.path().toLatin1().replace(0,1,"")  +
     86      emit newLogRecord(t_logRecord::message(t_logRecord::warning, _url.path().toLatin1().replace(0,1,"")  +
    8887                         ": NetQueryV2: server replied: " +
    89                          _reply->errorString().toLatin1(),
    90                          true);
     88                         _reply->errorString().toLatin1()), true);
    9189    }
    9290  }
    … …  
    10098void bncNetQueryV2::slotProxyAuthenticationRequired(const QNetworkProxy&,
    10199                                                    QAuthenticator*) {
    102   emit newMessage("slotProxyAuthenticationRequired", true);
     100  emit newLogRecord(t_logRecord::message(t_logRecord::warning, "slotProxyAuthenticationRequired"), true);
    103101}
    104102
    … …  
    240238  if (timedOut) {
    241239    _status = error;
    242     emit newMessage(_url.path().toLatin1().replace(0,1,"")
    243                     + ": Read timeout", true);
     240    emit newLogRecord(t_logRecord::message(t_logRecord::warning, _url.path().toLatin1().replace(0,1,"")
     241                    + ": Read timeout"), true);
    244242    disconnect(_reply, SIGNAL(finished()), this, SLOT(slotFinished()));
    245243    _reply->abort();
    … …  
    294292  if (_sslIgnoreErrors) {
    295293    _reply->ignoreSslErrors();
    296     BNC_CORE->slotMessage((msg + " (ignored as configured)").toLatin1(), true);
     294    BNC_CORE->message((msg + " (ignored as configured)").toLatin1(), true, "ntrip", t_logRecord::warning);
    297295  }
    298296  else {
    299     BNC_CORE->slotMessage(msg.toLatin1(), true);
     297    BNC_CORE->message(msg.toLatin1(), true, "ntrip", t_logRecord::error);
    300298    stop();
    301299  }
  • trunk/BNC/src/bncrawfile.cpp

    r11128 r11185  
    149149      int nBytes = lst.value(3).trimmed().toInt(&ok);
    150150      if (!ok || nBytes < 0 || nBytes > (1 << 24)) {
    151         BNC_CORE->slotMessage("Raw file: invalid chunk header: " + line.trimmed().left(80).toLatin1(), true);
     151        BNC_CORE->message("Raw file: invalid chunk header: " + line.trimmed().left(80).toLatin1(), true, "stream", t_logRecord::warning);
    152152        return data;
    153153      }
  • trunk/BNC/src/bncsettings.cpp

    r11179 r11185  
    8080        setValue_p("logFileStructured", "");
    8181        setValue_p("logFormatStructured", "json");
     82        setValue_p("logLevelStructured", "debug");
    8283        setValue_p("rnxAppend", "0");
    8384        setValue_p("onTheFlyInterval", "no");
  • trunk/BNC/src/bncwindow.cpp

    r11179 r11185  
    207207    _logFormatStructuredComboBox->setCurrentIndex(kLogFmt);
    208208  }
     209  _logLevelStructuredComboBox = new QComboBox();
     210  _logLevelStructuredComboBox->setEditable(false);
     211  _logLevelStructuredComboBox->addItems(QString("debug,info,warning,error").split(","));
     212  int kLogLev = _logLevelStructuredComboBox->findText(settings.value("logLevelStructured").toString());
     213  if (kLogLev != -1) {
     214    _logLevelStructuredComboBox->setCurrentIndex(kLogLev);
     215  }
    209216  _rawOutFileLineEdit = new QLineEdit(settings.value("rawOutFile").toString());
    210217  _ephMountLineEdit = new QLineEdit(settings.value("ephMount").toString());
    … …  
    855862  gLayout->addWidget(_logFileLineEdit, 1, 1, 1, 20);
    856863  gLayout->addWidget(new QLabel("Structured logfile"), 2, 0);
    857   gLayout->addWidget(_logFileStructuredLineEdit, 2, 1, 1, 15);
    858   gLayout->addWidget(new QLabel("  Format"), 2, 16, Qt::AlignRight);
    859   gLayout->addWidget(_logFormatStructuredComboBox, 2, 17, 1, 4);
     864  gLayout->addWidget(_logFileStructuredLineEdit, 2, 1, 1, 10);
     865  gLayout->addWidget(new QLabel("  Format"), 2, 11, Qt::AlignRight);
     866  gLayout->addWidget(_logFormatStructuredComboBox, 2, 12, 1, 3);
     867  gLayout->addWidget(new QLabel("  Min. level"), 2, 15, Qt::AlignRight);
     868  gLayout->addWidget(_logLevelStructuredComboBox, 2, 16, 1, 5);
    860869  gLayout->addWidget(new QLabel("Append files"), 3, 0);
    861870  gLayout->addWidget(_rnxAppendCheckBox, 3, 1);
    … …  
    15801589  // ------------------
    15811590  _logFileLineEdit->setWhatsThis(tr("<p>Records of BNC's activities are shown in the 'Log' tab on the bottom of this window. They can be saved into a file when a valid path for that is specified in the 'Logfile (full path)' field.</p><p>The logfile name will automatically be extended by a string '_YYMMDD' carrying the current date. <i>[key: logFile]</i></p>"));
    1582   _logFileStructuredLineEdit->setWhatsThis(tr("<p>In addition to the logfile, BNC can write the same records as a structured logfile for log processing tools: one record per line, either JSON (JSON Lines) or logfmt (key=value pairs separated by blanks). Each record carries the time in UTC ('time', ISO 8601 with 'Z') and in GPS time ('gpst'), a level (info, warning, error), the component (e.g. stream, ppp), the event (e.g. ppp_position, stream_outage_begin), the station if known, the event's fields, the text of the classic logfile ('msg') and the record version ('v').</p><p>Messages without own event are written with component 'bnc' and event 'message'; their level is derived from keywords of the text. The logfile itself remains unchanged.</p><p>The file name will automatically be extended by a string '_YYMMDD' carrying the current date. Default is an empty option field, meaning that no structured logfile is written. <i>[key: logFileStructured]</i></p>"));
     1591  _logFileStructuredLineEdit->setWhatsThis(tr("<p>In addition to the logfile, BNC can write the same records as a structured logfile for log processing tools: one record per line, either JSON (JSON Lines) or logfmt (key=value pairs separated by blanks). Each record carries the time in UTC ('time', ISO 8601 with 'Z') and in GPS time ('gpst'), a level (debug, info, warning, error), the component (e.g. stream, ppp, cmb), the event (e.g. ppp_position, stream_outage_begin), the stream (mountpoint) or PPP station if known, the event's fields, the text of the classic logfile ('msg') and the record version ('v').</p><p>Messages without own event are written with event 'message' and the component of their origin; their level is error (a function does not work), warning (data or configuration problem, BNC continues) or info (status). The logfile itself remains unchanged.</p><p>The file name will automatically be extended by a string '_YYMMDD' carrying the current date. Default is an empty option field, meaning that no structured logfile is written. <i>[key: logFileStructured]</i></p>"));
    15831592  _logFormatStructuredComboBox->setWhatsThis(tr("<p>Select the format of the structured logfile: 'json' for one JSON object per line (JSON Lines), 'logfmt' for key=value pairs. Default is 'json'. <i>[key: logFormatStructured]</i></p>"));
     1593  _logLevelStructuredComboBox->setWhatsThis(tr("<p>Select the minimum level of the records written into the structured logfile: 'debug' writes all records (debug records exist only in BNC versions built with the BNC_DEBUG_* defines), 'info' leaves out the debug records, 'warning' writes warnings and errors only, 'error' errors only. The logfile is not affected. Default is 'debug'. <i>[key: logLevelStructured]</i></p>"));
    15841594  _rnxAppendCheckBox->setWhatsThis(tr("<p>When BNC is started, new files are created by default and file content already available under the same name will be overwritten. However, users might want to append already existing files following a regular restart or a crash of BNC or its platform.</p><p>Tick 'Append files' to continue with existing files and keep what has been recorded so far. <i>[key: rnxAppend]</i></p>"));
    15851595  _onTheFlyComboBox->setWhatsThis(tr("<p>When operating BNC online in 'no window' mode, some configuration parameters can be changed on-the-fly without interrupting the running process. For that BNC rereads parts of its configuration in pre-defined intervals. The default entry is 'no' that means the reread function is switched of. <p></p>Select '1 min', '5 min', '1 hour', or '1 day' to force BNC to reread its configuration every full minute, five minutes, hour, or day and let in between edited configuration options become effective on-the-fly without terminating uninvolved threads.</p><p>Note that when operating BNC in window mode, on-the-fly changeable configuration options become effective immediately via button 'Save & Reread Configuration'. <i>[key: onTheFlyInterval]</i></p>"));
    … …  
    18971907  delete _logFileStructuredLineEdit;
    18981908  delete _logFormatStructuredComboBox;
     1909  delete _logLevelStructuredComboBox;
    18991910  delete _rawOutFileLineEdit;
    19001911  delete _ephMountLineEdit;
    … …  
    24322443  settings.setValue("logFileStructured", _logFileStructuredLineEdit->text());
    24332444  settings.setValue("logFormatStructured", _logFormatStructuredComboBox->currentText());
     2445  settings.setValue("logLevelStructured", _logLevelStructuredComboBox->currentText());
    24342446  settings.setValue("rnxAppend", _rnxAppendCheckBox->checkState());
    24352447  settings.setValue("onTheFlyInterval", _onTheFlyComboBox->currentText());
    … …  
    25682580////////////////////////////////////////////////////////////////////////////
    25692581void bncWindow::slotGetThreadsFinished() {
    2570   BNC_CORE->slotMessage("All Get Threads Terminated", true);
     2582  BNC_CORE->message("All Get Threads Terminated", true, "bnc", t_logRecord::info);
    25712583  delete _caster;    _caster = 0; BNC_CORE->setCaster(0);
    25722584  delete _casterEph; _casterEph = 0;
    … …  
    26382650  connect(_caster, SIGNAL(mountPointsRead(QList<bncGetThread*>)), this, SLOT(slotMountPointsRead(QList<bncGetThread*>)));
    26392651
    2640   BNC_CORE->slotMessage("========== Start BNC v" BNCVERSION " (" BNC_OS ") ==========", true);
     2652  BNC_CORE->message("========== Start BNC v" BNCVERSION " (" BNC_OS ") ==========", true, "bnc", t_logRecord::info);
    26412653
    26422654  bncSettings settings;
    … …  
    26452657  // -------------
    26462658  if (!_rnxPathLineEdit->text().isEmpty())
    2647     BNC_CORE->slotMessage("Panel 'RINEX Observations' active", true);
     2659    BNC_CORE->message("Panel 'RINEX Observations' active", true, "bnc", t_logRecord::info);
    26482660  if (!_ephPathLineEdit->text().isEmpty())
    2649     BNC_CORE->slotMessage("Panel 'RINEX Ephemeris' active", true);
     2661    BNC_CORE->message("Panel 'RINEX Ephemeris' active", true, "bnc", t_logRecord::info);
    26502662  if (!_corrPathLineEdit->text().isEmpty())
    2651     BNC_CORE->slotMessage("Panel 'Broadcast Corrections' active", true);
     2663    BNC_CORE->message("Panel 'Broadcast Corrections' active", true, "bnc", t_logRecord::info);
    26522664  if (!_outPortLineEdit->text().isEmpty())
    2653     BNC_CORE->slotMessage("Panel 'Feed Engine' active", true);
     2665    BNC_CORE->message("Panel 'Feed Engine' active", true, "bnc", t_logRecord::info);
    26542666  if (!_serialMountPointLineEdit->text().isEmpty())
    2655     BNC_CORE->slotMessage("Panel 'Serial Output' active", true);
     2667    BNC_CORE->message("Panel 'Serial Output' active", true, "bnc", t_logRecord::info);
    26562668  if (!_adviseObsRateComboBox->currentText().isEmpty())
    2657     BNC_CORE->slotMessage("Panel 'Outages' active", true);
     2669    BNC_CORE->message("Panel 'Outages' active", true, "bnc", t_logRecord::info);
    26582670  if (!_miscMountLineEdit->text().isEmpty())
    2659     BNC_CORE->slotMessage("Panel 'Miscellaneous' active", true);
     2671    BNC_CORE->message("Panel 'Miscellaneous' active", true, "bnc", t_logRecord::info);
    26602672  if (_pppWidgets._dataSource->currentText() == "Real-Time Streams")
    2661     BNC_CORE->slotMessage("Panel 'PPP' active", true);
     2673    BNC_CORE->message("Panel 'PPP' active", true, "bnc", t_logRecord::info);
    26622674  if (_cmbTable->rowCount() > 0)
    2663     BNC_CORE->slotMessage("Panel 'Combine Corrections' active", true);
     2675    BNC_CORE->message("Panel 'Combine Corrections' active", true, "bnc", t_logRecord::info);
    26642676  if (_uploadTable->rowCount() > 0)
    2665     BNC_CORE->slotMessage("Panel 'Upload Corrections' active", true);
     2677    BNC_CORE->message("Panel 'Upload Corrections' active", true, "bnc", t_logRecord::info);
    26662678  if (_uploadEphTable->rowCount() > 0)
    2667     BNC_CORE->slotMessage("Panel 'UploadEphemeris' active", true);
     2679    BNC_CORE->message("Panel 'UploadEphemeris' active", true, "bnc", t_logRecord::info);
    26682680
    26692681  QDir rnxdir(settings.value("rnxPath").toString());
    2670   if (!rnxdir.exists()) BNC_CORE->slotMessage("Cannot find RINEX Observations directory", true);
     2682  if (!rnxdir.exists()) BNC_CORE->message("Cannot find RINEX Observations directory", true, "bnc", t_logRecord::error);
    26712683
    26722684  QString rnx_file = settings.value("rnxScript").toString();
    26732685  if (!rnx_file.isEmpty()) {
    26742686    QFile rnxfile(settings.value("rnxScript").toString());
    2675     if (!rnxfile.exists()) BNC_CORE->slotMessage("Cannot find RINEX Observations script", true);
     2687    if (!rnxfile.exists()) BNC_CORE->message("Cannot find RINEX Observations script", true, "bnc", t_logRecord::error);
    26762688  }
    26772689
    26782690  QDir ephdir(settings.value("ephPath").toString());
    2679   if (!ephdir.exists()) BNC_CORE->slotMessage("Cannot find RINEX Ephemeris directory", true);
     2691  if (!ephdir.exists()) BNC_CORE->message("Cannot find RINEX Ephemeris directory", true, "bnc", t_logRecord::error);
    26802692
    26812693  QDir corrdir(settings.value("corrPath").toString());
    2682   if (!corrdir.exists()) BNC_CORE->slotMessage("Cannot find Broadcast Corrections directory", true);
     2694  if (!corrdir.exists()) BNC_CORE->message("Cannot find Broadcast Corrections directory", true, "bnc", t_logRecord::error);
    26832695
    26842696  QString advise_file = settings.value("adviseScript").toString();
    26852697  if (!advise_file.isEmpty()) {
    26862698    QFile advisefile(settings.value("adviseScript").toString());
    2687     if (!advisefile.exists()) BNC_CORE->slotMessage("Cannot find Outages script", true);
     2699    if (!advisefile.exists()) BNC_CORE->message("Cannot find Outages script", true, "bnc", t_logRecord::error);
    26882700  }
    26892701
  • trunk/BNC/src/bncwindow.h

    r11179 r11185  
    186186    QLineEdit* _logFileStructuredLineEdit;
    187187    QComboBox* _logFormatStructuredComboBox;
     188    QComboBox* _logLevelStructuredComboBox;
    188189    QLineEdit* _rawOutFileLineEdit;
    189190    QLineEdit* _ephMountLineEdit;
  • 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  }
  • trunk/BNC/src/combination/bnccomb.h

    r11123 r11185  
    1616#include "bncephuser.h"
    1717#include "satObs.h"
     18#include "bnclog.h"
    1819#include "bncconst.h"
    1920#include "bncoutf.h"
    … …  
    5455 signals:
    5556  void newMessage(QByteArray msg, bool showOnScreen);
     57  void newLogRecord(t_logRecord rec, bool showOnScreen);
    5658  void newOrbCorrections(QList<t_orbCorr>);
    5759  void newClkCorrections(QList<t_clkCorr>);
  • trunk/BNC/src/latencychecker.cpp

    r11179 r11185  
    6060  _curLat = 0.0;
    6161
    62   connect(this, SIGNAL(newMessage(QByteArray,bool)),
    63           BNC_CORE, SLOT(slotMessage(const QByteArray,bool)));
    64   connect(this, SIGNAL(newLogRecord(t_logRecord,bool)),
    65           BNC_CORE, SLOT(slotLogRecord(t_logRecord,bool)));
     62  BNC_CORE->connectMessages(this, "stream");
     63  BNC_CORE->connectLogRecords(this, "stream");
    6664
    6765  bncSettings settings;
  • trunk/BNC/src/pppMain.cpp

    r11136 r11185  
    9393  }
    9494  catch (t_except exc) {
    95     BNC_CORE->slotMessage(QByteArray::fromStdString(exc.what()), true);
     95    BNC_CORE->message(QByteArray::fromStdString(exc.what()), true, "ppp", t_logRecord::error);
    9696    _running = true;
    9797    stop();
  • trunk/BNC/src/pppRun.cpp

    r11179 r11185  
    6868  _opt = opt;
    6969
    70   connect(this, SIGNAL(newMessage(QByteArray,bool)),
    71           BNC_CORE, SLOT(slotMessage(const QByteArray,bool)));
    72   connect(this, SIGNAL(newLogRecord(t_logRecord,bool)),
    73           BNC_CORE, SLOT(slotLogRecord(t_logRecord,bool)));
    74   t_logRecord::registerStation(QByteArray(_opt->_roverName.c_str()));
     70  BNC_CORE->connectMessages(this, "ppp");
     71  BNC_CORE->connectLogRecords(this, "ppp");
     72  t_logRecord::registerStream(QByteArray(_opt->_roverName.c_str()));
    7573
    7674  connect(this,     SIGNAL(newPosition(QByteArray, bncTime, QVector<double>)),
    … …  
    8886                                                                Qt::SkipEmptyParts);
    8987    if (!_ephMounts.isEmpty()) {
    90       emit newMessage(QByteArray(_opt->_roverName.c_str()) + ": PPP uses the ephemerides of "
    91                       + _ephMounts.join(", ").toLatin1() + " only", true);
     88      emit newLogRecord(t_logRecord::message(t_logRecord::info, QByteArray(_opt->_roverName.c_str()) + ": PPP uses the ephemerides of "
     89                      + _ephMounts.join(", ").toLatin1() + " only"), true);
    9290    }
    9391
    … …  
    748746        }
    749747        catch (const char* msg) {
    750           emit newMessage(QByteArray(msg), true);
     748          emit newLogRecord(t_logRecord::message(t_logRecord::error, QByteArray(msg)), true);
    751749          break;
    752750        }
    753751        catch (const string& msg) {
    754           emit newMessage(QByteArray(msg.c_str()), true);
     752          emit newLogRecord(t_logRecord::message(t_logRecord::error, QByteArray(msg.c_str())), true);
    755753          break;
    756754        }
    757755        catch (...) {
    758           emit newMessage("unknown exceptions in file " + file->name().toLatin1(), true);
     756          emit newLogRecord(t_logRecord::message(t_logRecord::error, "unknown exceptions in file " + file->name().toLatin1()), true);
    759757          break;
    760758        }
    … …  
    888886
    889887  QString msg = "pppRun " + QString(_opt->_roverName.c_str()) + ": SSR Provider or Service changed: " + mountPoint;
    890   emit newMessage(msg.toLatin1(), true);
     888  emit newLogRecord(t_logRecord::message(t_logRecord::info, msg.toLatin1()), true);
    891889
    892890  _pppClient->reset();
  • trunk/BNC/src/pppThread.cpp

    r11057 r11185  
    6262  connect(this, SIGNAL(finished()), this, SLOT(deleteLater()));
    6363
    64   connect(this, SIGNAL(newMessage(QByteArray,bool)),
    65           BNC_CORE, SLOT(slotMessage(const QByteArray,bool)));
     64  BNC_CORE->connectMessages(this, "ppp");
     65  BNC_CORE->connectLogRecords(this, "ppp");
    6666}
    6767
    … …  
    8989    _pppRun = 0;
    9090    _ready.release();
    91     emit newMessage(QByteArray(exc.what().c_str()), true);
     91    emit newLogRecord(t_logRecord::message(t_logRecord::error, QByteArray(exc.what().c_str())), true);
    9292  }
    9393}
  • trunk/BNC/src/pppThread.h

    r11057 r11185  
    66#include <QtCore>
    77
     8#include "bnclog.h"
    89#include "pppOptions.h"
    910#include "pppClient.h"
    … …  
    2425 signals:
    2526  void newMessage(QByteArray msg, bool showOnScreen);
     27  void newLogRecord(t_logRecord rec, bool showOnScreen);
    2628
    2729 private:
  • trunk/BNC/src/ssrQc.cpp

    r11148 r11185  
    145145  }
    146146
    147   connect(this, SIGNAL(newMessage(QByteArray,bool)), BNC_CORE, SLOT(slotMessage(const QByteArray,bool)));
     147  BNC_CORE->connectMessages(this, "ssrqc");
     148  BNC_CORE->connectLogRecords(this, "ssrqc");
    148149  for (const QString& err : t_ssrRefSig::init()) {
    149     emit newMessage(("SSR QC: " + err).toLatin1(), true);
     150    emit newLogRecord(t_logRecord::message(t_logRecord::warning, ("SSR QC: " + err).toLatin1()), true);
    150151  }
    151152  // reference code biases from a Bias SINEX file (optional)
    … …  
    160161    }
    161162    else {
    162       emit newMessage(("SSR QC: wrong Bias SINEX file " + bsxFile).toLatin1(), true);
     163      emit newLogRecord(t_logRecord::message(t_logRecord::warning, ("SSR QC: wrong Bias SINEX file " + bsxFile).toLatin1()), true);
    163164      delete _bsxRef;
    164165      _bsxRef = 0;
    … …  
    171172    _antex = new bncAntex();
    172173    if (_antex->readFile(antexFile) != success || _antex->numSatPrns() == 0) {
    173       emit newMessage(("SSR QC: wrong ANTEX file " + antexFile + " - no attitude check").toLatin1(), true);
     174      emit newLogRecord(t_logRecord::message(t_logRecord::warning, ("SSR QC: wrong ANTEX file " + antexFile + " - no attitude check").toLatin1()), true);
    174175      delete _antex;
    175176      _antex = 0;
    … …  
    17581759  }
    17591760
    1760   emit newMessage(QString("SSR QC: report %1 %2 of %3 stream(s) written to %4")
     1761  emit newLogRecord(t_logRecord::message(t_logRecord::info, QString("SSR QC: report %1 %2 of %3 stream(s) written to %4")
    17611762                  .arg(QString::fromStdString(_intervalStart.datestr()))
    17621763                  .arg(QString::fromStdString(_intervalStart.timestr(0)))
    1763                   .arg(streams.size()).arg(_dirName).toLatin1(), false);
     1764                  .arg(streams.size()).arg(_dirName).toLatin1()), false);
    17641765
    17651766  _cmpStat.clear();
  • trunk/BNC/src/ssrQc.h

    r11137 r11185  
    44#include <QtCore>
    55#include <fstream>
     6#include "bnclog.h"
    67#include "bncephuser.h"
    78#include "bnctime.h"
    … …  
    3536 signals:
    3637  void newMessage(QByteArray msg, bool showOnScreen);
     38  void newLogRecord(t_logRecord rec, bool showOnScreen);
    3739
    3840 private:
  • trunk/BNC/src/upload/bncrtnetuploadcaster.cpp

    r11179 r11185  
    330330
    331331    if (lines.size() < 2) {
    332         emit(newMessage(
    333             "bncRtnetUploadCaster: less than 2 lines to decode " + _casterID.toLatin1(), false));
     332        emit newLogRecord(t_logRecord::message(t_logRecord::warning, "bncRtnetUploadCaster: less than 2 lines to decode " + _casterID.toLatin1()), false);
    334333        return;
    335334    }
    … …  
    354353    epoTime.set(year, month, day, hour, min, sec);
    355354
    356     emit(newMessage(
    357         "bncRtnetUploadCaster: decode " + QByteArray(epoTime.datestr().c_str())
     355    emit newLogRecord(t_logRecord::message(t_logRecord::info, "bncRtnetUploadCaster: decode " + QByteArray(epoTime.datestr().c_str())
    358356        + " " + QByteArray(epoTime.timestr().c_str()) + " "
    359         + _casterID.toLatin1(), false));
     357        + _casterID.toLatin1()), false);
    360358
    361359    struct SsrCorr::ClockOrbit co;
    … …  
    697695                        in >> dummy;
    698696                    }
    699                     emit(newMessage("                      RTNET format error: "
    700                         + lines[ii].toLatin1(), false));
     697                    emit newLogRecord(t_logRecord::message(t_logRecord::error, "                      RTNET format error: "
     698                        + lines[ii].toLatin1()), false);
    701699                    break;
    702700                }
    … …  
    11801178
    11811179        if (corrIsOutOfRange(sd)) {
    1182             emit(newMessage(QString("bncRtnetUploadCaster: SSR parameter is out of its defined range").toLatin1(), false));
     1180            emit newLogRecord(t_logRecord::message(t_logRecord::warning, QString("bncRtnetUploadCaster: SSR parameter is out of its defined range").toLatin1()), false);
    11831181            return failure;
    11841182        }
  • trunk/BNC/src/upload/bncuploadcaster.cpp

    r11153 r11185  
    6363  _isToBeDeleted = false;
    6464
    65   connect(this, SIGNAL(newMessage(QByteArray,bool)), BNC_CORE, SLOT(slotMessage(const QByteArray,bool)));
     65  BNC_CORE->connectMessages(this, "upload");
     66  BNC_CORE->connectLogRecords(this, "upload");
    6667
    6768  if (BNC_CORE->_uploadTableItems.find(_iRow) != BNC_CORE->_uploadTableItems.end()) {
    … …  
    9596      // no fallback to Ntrip Version 2: user name and password would be sent
    9697      // unencrypted although an encrypted connection was configured
    97       emit(newMessage(_mountpoint.toLatin1() + "@" + _casterOutHost.toLatin1() +
    98           ": No SSL support, please install OpenSSL run-time libraries: no upload", true));
     98      emit newLogRecord(t_logRecord::message(t_logRecord::error, _mountpoint.toLatin1() + "@" + _casterOutHost.toLatin1() +
     99          ": No SSL support, please install OpenSSL run-time libraries: no upload"), true);
    99100    } else {
    100101      _secure = true;
    … …  
    137138void bncUploadCaster::slotProxyAuthenticationRequired(const QNetworkProxy&,
    138139    QAuthenticator*) {
    139   emit newMessage("slotProxyAuthenticationRequired", true);
     140  emit newLogRecord(t_logRecord::message(t_logRecord::warning, "slotProxyAuthenticationRequired"), true);
    140141}
    141142
    … …  
    171172      msg += " (ignored as configured)";
    172173    }
    173     emit(newMessage(_mountpoint.toLatin1() + "@" + _casterOutHost.toLatin1() + ": " + msg.toLatin1(), true));
     174    emit newLogRecord(t_logRecord::message((_sslIgnoreErrors ? t_logRecord::warning : t_logRecord::error), _mountpoint.toLatin1() + "@" + _casterOutHost.toLatin1() + ": " + msg.toLatin1()), true);
    174175  }
    175176}
    … …  
    274275  } else {
    275276    if (_ntripVersion == "1") {
    276       emit(newMessage("No proxy support in Ntrip Version 1 upload!", true));
     277      emit newLogRecord(t_logRecord::message(t_logRecord::warning, "No proxy support in Ntrip Version 1 upload!"), true);
    277278      delete _outSocket; _outSocket = 0;
    278279      return;
    … …  
    299300      if (!statusOk(ans)) {
    300301        int l = ans.indexOf("\r\n", 0);
    301         emit(newMessage("Proxy: Connection broken for " + _mountpoint.toLatin1() + "@" +
    302             _casterOutHost.toLatin1() + ":" + QString("%1").arg(_casterOutPort).toLatin1()  + ": "  + ans.left(l), true));
     302        emit newLogRecord(t_logRecord::message(t_logRecord::warning, "Proxy: Connection broken for " + _mountpoint.toLatin1() + "@" +
     303            _casterOutHost.toLatin1() + ":" + QString("%1").arg(_casterOutPort).toLatin1()  + ": "  + ans.left(l)), true);
    303304        delete _outSocket; _outSocket = 0;
    304305        return;
    305306      } else {
    306         emit(newMessage("Proxy: Connection established for " + _mountpoint.toLatin1()+ "@" +
    307             _casterOutHost.toLatin1() + ":" + QString("%1").arg(_casterOutPort).toLatin1() , true));
     307        emit newLogRecord(t_logRecord::message(t_logRecord::info, "Proxy: Connection established for " + _mountpoint.toLatin1()+ "@" +
     308            _casterOutHost.toLatin1() + ":" + QString("%1").arg(_casterOutPort).toLatin1()), true);
    308309        _sOpenTrial = 0;
    309310        _outSocket->setPeerVerifyName(_casterOutHost);
    310311        _outSocket->startClientEncryption();
    311312        if (!_outSocket->waitForEncrypted(timeOut)) {
    312           emit(newMessage("Proxy/Caster: Encrypt timeout for " + _mountpoint.toLatin1() + "@"
     313          emit newLogRecord(t_logRecord::message(t_logRecord::warning, "Proxy/Caster: Encrypt timeout for " + _mountpoint.toLatin1() + "@"
    313314                          + _casterOutHost.toLatin1() + ":"
    314315                          + QString("%1) ").arg(_casterOutPort).toLatin1()
    315                           + _outSocket->errorString().toLatin1(), true));
     316                          + _outSocket->errorString().toLatin1()), true);
    316317          delete _outSocket; _outSocket = 0;
    317318          return;
    318319        } else {
    319           emit(newMessage("Proxy: SSL handshake completed for " + _mountpoint.toLatin1() + "@" +
    320               _casterOutHost.toLatin1() + ":" + QString("%1").arg(_casterOutPort).toLatin1(), true));
     320          emit newLogRecord(t_logRecord::message(t_logRecord::info, "Proxy: SSL handshake completed for " + _mountpoint.toLatin1() + "@" +
     321              _casterOutHost.toLatin1() + ":" + QString("%1").arg(_casterOutPort).toLatin1()), true);
    321322        }
    322323      }
    … …  
    347348    delete _outSocket; _outSocket = 0;
    348349    int l = ans.indexOf("\r\n", 0);
    349     emit(newMessage("Broadcaster: Connection broken for " + _mountpoint.toLatin1() + "@" +
     350    emit newLogRecord(t_logRecord::message(t_logRecord::warning, "Broadcaster: Connection broken for " + _mountpoint.toLatin1() + "@" +
    350351         _casterOutHost.toLatin1() + ":" + QString("%1").arg(_casterOutPort).toLatin1() +
    351          ": " + ans.left(l), true));
    352   } else {
    353     emit(newMessage("Broadcaster: Connection opened for " + _mountpoint.toLatin1() + "@" +
    354         _casterOutHost.toLatin1() + ":" + QString("%1").arg(_casterOutPort).toLatin1() , true));
     352         ": " + ans.left(l)), true);
     353  } else {
     354    emit newLogRecord(t_logRecord::message(t_logRecord::info, "Broadcaster: Connection opened for " + _mountpoint.toLatin1() + "@" +
     355        _casterOutHost.toLatin1() + ":" + QString("%1").arg(_casterOutPort).toLatin1()), true);
    355356    _sOpenTrial = 0;
    356357  }
    … …  
    364365    _outSocket->connectToHostEncrypted(outHost, outPort);
    365366    if (!_outSocket->waitForEncrypted(timeOut)) {
    366       emit(newMessage(
    367            "Broadcaster: Connect timeout for " + _mountpoint.toLatin1() + "@"
     367      emit newLogRecord(t_logRecord::message(t_logRecord::warning, "Broadcaster: Connect timeout for " + _mountpoint.toLatin1() + "@"
    368368              + outHost.toLatin1() + ":"
    369369              + QString("%1) ").arg(outPort).toLatin1()
    370               + _outSocket->errorString().toLatin1(), true));
     370              + _outSocket->errorString().toLatin1()), true);
    371371      delete _outSocket; _outSocket = 0;
    372372      return false;
    373373    } else {
    374       emit(newMessage("Broadcaster: SSL handshake completed for " + _mountpoint.toLatin1() + "@" +
    375           _casterOutHost.toLatin1() + ":" + QString("%1").arg(_casterOutPort).toLatin1(), true));
     374      emit newLogRecord(t_logRecord::message(t_logRecord::info, "Broadcaster: SSL handshake completed for " + _mountpoint.toLatin1() + "@" +
     375          _casterOutHost.toLatin1() + ":" + QString("%1").arg(_casterOutPort).toLatin1()), true);
    376376    }
    377377  } else {
    378378    _outSocket->connectToHost(outHost, outPort);
    379379    if (!_outSocket->waitForConnected(timeOut)) {
    380       emit(newMessage("Broadcaster: Connect timeout for " + _mountpoint.toLatin1() + "@"
     380      emit newLogRecord(t_logRecord::message(t_logRecord::warning, "Broadcaster: Connect timeout for " + _mountpoint.toLatin1() + "@"
    381381              + outHost.toLatin1() + ":"
    382382              + QString("%1) ").arg(outPort).toLatin1()
    383               + _outSocket->errorString().toLatin1(), true));
     383              + _outSocket->errorString().toLatin1()), true);
    384384      delete _outSocket; _outSocket = 0;
    385385      return false;
  • trunk/BNC/src/upload/bncuploadcaster.h

    r11060 r11185  
    1010#include <QSslKey>
    1111#include <iostream>
     12#include "bnclog.h"
    1213
    1314
    … …  
    3940 signals:
    4041  void newMessage(const QByteArray msg, bool showOnScreen);
     42  void newLogRecord(t_logRecord rec, bool showOnScreen);
    4143  void newBytes(QByteArray staID, double nbyte);
    4244
Note: See TracChangeset for help on using the changeset viewer.