Changeset 11185 in ntrip for trunk/BNC/src/upload


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

Structured logging improved

Location:
trunk/BNC/src/upload
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • 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.