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

Structured logging improved

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/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;
Note: See TracChangeset for help on using the changeset viewer.