Changeset 11187 in ntrip for trunk/BNC/src/bnclog.cpp


Ignore:
Timestamp:
Nov 9, 2026, 5:37:55 PM (less than one hour ago)
Author:
stuerze
Message:

Structured logging improved

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/bnclog.cpp

    r11185 r11187  
    2121#include "bnclog.h"
    2222#include "bncutils.h"
     23#include "bnctime.h"
    2324
    2425namespace {
    … …  
    211212//
    212213////////////////////////////////////////////////////////////////////////////
     214t_logRecord& t_logRecord::setEpoch(const bncTime& epoch) {
     215  if (epoch.valid()) {
     216    _epoch = QByteArray((epoch.datestr() + 'T' + epoch.timestr(3)).c_str());
     217  }
     218  else {
     219    _epoch.clear();
     220  }
     221  return *this;
     222}
     223
     224//
     225////////////////////////////////////////////////////////////////////////////
    213226const char* t_logRecord::levelString(e_level level) {
    214227  switch (level) {
    … …  
    254267  QDateTime utc = gpst.addSecs(-gnumleap(dd.year(), dd.month(), dd.day()));
    255268
    256   QByteArray msg = _msg;
     269  QByteArray msg = _msgStructured.isEmpty() ? _msg : _msgStructured;
    257270  while (msg.startsWith('\n')) {
    258271    msg.remove(0, 1);
    … …  
    266279  };
    267280  put("time",      utc.toString("yyyy-MM-ddThh:mm:ss.zzz").toLatin1() + "Z", true);
    268   put("gpst",      gpst.toString("yyyy-MM-ddThh:mm:ss.zzz").toLatin1(), true);
     281  if (!_epoch.isEmpty()) {
     282    put("epoch",   _epoch, true);
     283  }
    269284  put("level",     levelString(_level), true);
    270285  put("component", _component, true);
    271286  put("event",     _event, true);
    272287  if (!_stream.isEmpty()) {
    273     put("stream", _stream, true);
     288    put("mp", _stream, true);
    274289  }
    275290  all += _fields;
Note: See TracChangeset for help on using the changeset viewer.