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


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/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}
Note: See TracChangeset for help on using the changeset viewer.