обновил журналирование для разработчиков

This commit is contained in:
Vladislav Ostapov 2025-01-30 11:25:26 +03:00
parent a59c8e48d9
commit f8b5605ac3
2 changed files with 10 additions and 5 deletions

View File

@ -130,7 +130,7 @@ std::string makeTimepointFromMillis(int64_t unix_time_ms) {
tm* t = std::localtime(&tp);
std::stringstream ss;
ss << std::put_time(t, "%y-%m-%d %H:%M:%S");
ss << std::put_time(t, "%Y-%m-%d %H:%M:%S");
auto ms = (unix_time_ms % 1000);
ss << '.' << std::setw(3) << std::setfill('0') << ms;
return ss.str();
@ -172,7 +172,7 @@ public:
if (newEn) {
this->logFile.open("/tmp/weblog-statistics.csv", std::ios::out);
if (this->logFile.is_open()) {
const auto* header = "timestamp\tpkt ok\tpkt bad\tfine freq dem\tcrs freq dem\tcrs freq compensator\tcrs time est\tfine time est\tmax level corr\torigin delay\tSNR\tmodcod\tfine freq compensator\tind freq grb\tind freq tochn\tind filt adapt\tfilter corr cinc\tcorr cnt\n";
const auto* header = "timestamp\tcnt ok\tcnt bad\tfine freq dem\tcrs freq dem\tcrs freq compensator\tcrs time est\tfine time est\tmax level corr\tcurrent delay\tSNR\tcurrent modcod\tfine freq compensator\tind freq grb\tind freq tochn\tind filt adapt\tfilter corr cinc\tcorr cnt\tRSS\tcor erl\tcor lat\tgc gain\tpower pl rx\n";
this->logFile.write(header, static_cast<std::streamsize>(strlen(header)));
this->logEn = true;
this->timeStart = TIME_NOW();
@ -204,7 +204,7 @@ public:
res << item.crs_time_est << '\t';
res << item.fine_time_est << '\t';
res << item.max_level_corr << '\t';
res << item.origin_delay << '\t';
res << item.current_delay << '\t';
res << item.SNR << '\t';
res << item.current_modcod << '\t';
res << item.fine_freq_compensator << '\t';
@ -212,7 +212,12 @@ public:
res << item.ind_freq_tochn << '\t';
res << item.ind_filt_adapt << '\t';
res << item.filter_corr_cinc << '\t';
res << item.corr_cnt << '\n';
res << item.corr_cnt << '\t';
res << item.RSS << '\t';
res << item.cor_erl << '\t';
res << item.cor_lat << '\t';
res << item.gc_gain << '\t';
res << item.power_pl_rx << '\n';
const auto out = res.str();
this->logFile.write(out.c_str(), static_cast<std::streamsize>(out.length()));

View File

@ -190,7 +190,7 @@
fetch(`/dev/logs.csv`, {method: 'GET', credentials: 'same-origin' })
.then(async (resp) => {
let logfileContent = await resp.text()
const lines = logfileContent.split(/\r\n|\n/)
const lines = logfileContent.trim().split(/\r\n|\n/)
// Первая строка содержит заголовки
this.logsTable.headers = lines.shift().split('\t')