Changeset 11185 in ntrip for trunk/BNC/src/bncwindow.cpp


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

Structured logging improved

File:
1 edited

Legend:

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