From abed50bf7fb029032bd60e78948b5709aa060cfc Mon Sep 17 00:00:00 2001 From: Bastian Bloessl Date: Fri, 4 Aug 2023 13:09:57 +0200 Subject: [PATCH] change logging --- lib/decode_mac.cc | 7 ++++--- lib/frame_equalizer_impl.cc | 7 ++++--- lib/parse_mac.cc | 3 +-- lib/sync_long.cc | 3 +-- lib/sync_short.cc | 3 +-- lib/utils.h | 4 ++-- 6 files changed, 13 insertions(+), 14 deletions(-) diff --git a/lib/decode_mac.cc b/lib/decode_mac.cc index 3f64cfd..a9da87f 100644 --- a/lib/decode_mac.cc +++ b/lib/decode_mac.cc @@ -21,7 +21,6 @@ #include #include -#include #include using namespace gr::ieee802_11; @@ -147,8 +146,10 @@ public: return; } - mylog(boost::format("encoding: %1% - length: %2% - symbols: %3%") % - d_ofdm.encoding % d_frame.psdu_size % d_frame.n_sym); + mylog("encoding: {} - length: {} - symbols: {}", + d_ofdm.encoding, + d_frame.psdu_size, + d_frame.n_sym); // create PDU pmt::pmt_t blob = pmt::make_blob(out_bytes + 2, d_frame.psdu_size - 4); diff --git a/lib/frame_equalizer_impl.cc b/lib/frame_equalizer_impl.cc index de2ee7c..253489a 100644 --- a/lib/frame_equalizer_impl.cc +++ b/lib/frame_equalizer_impl.cc @@ -23,7 +23,6 @@ #include "frame_equalizer_impl.h" #include "utils.h" #include -#include namespace gr { namespace ieee802_11 { @@ -360,8 +359,10 @@ bool frame_equalizer_impl::parse_signal(uint8_t* decoded_bits) return false; } - mylog(boost::format("encoding: %1% - length: %2% - symbols: %3%") % d_frame_encoding % - d_frame_bytes % d_frame_symbols); + mylog("encoding: {} - length: {} - symbols: {}", + d_frame_encoding, + d_frame_bytes, + d_frame_symbols); return true; } diff --git a/lib/parse_mac.cc b/lib/parse_mac.cc index 4007a1d..3d1ea47 100644 --- a/lib/parse_mac.cc +++ b/lib/parse_mac.cc @@ -21,7 +21,6 @@ #include #include #include -#include using namespace gr::ieee802_11; @@ -64,7 +63,7 @@ public: int frame_len = pmt::blob_length(d_msg); mac_header* h = (mac_header*)pmt::blob_data(d_msg); - mylog(boost::format("length: %1%") % frame_len); + mylog("length: {}",frame_len); dout << std::endl << "new mac frame (length " << frame_len << ")" << std::endl; dout << "=========================================" << std::endl; diff --git a/lib/sync_long.cc b/lib/sync_long.cc index 11da6d5..544fcfd 100644 --- a/lib/sync_long.cc +++ b/lib/sync_long.cc @@ -23,7 +23,6 @@ #include #include -#include using namespace gr::ieee802_11; using namespace std; @@ -113,7 +112,7 @@ public: if (d_offset == SYNC_LENGTH) { search_frame_start(); - mylog(boost::format("LONG: frame start at %1%") % d_frame_start); + mylog("LONG: frame start at {}",d_frame_start); d_offset = 0; d_count = 0; d_state = COPY; diff --git a/lib/sync_short.cc b/lib/sync_short.cc index 55e8b84..af0988b 100644 --- a/lib/sync_short.cc +++ b/lib/sync_short.cc @@ -19,7 +19,6 @@ #include #include -#include using namespace gr::ieee802_11; @@ -139,7 +138,7 @@ public: void insert_tag(uint64_t item, double freq_offset, uint64_t input_item) { - mylog(boost::format("frame start at in: %2% out: %1%") % item % input_item); + mylog("frame start at in: {} out: {}", item, input_item); const pmt::pmt_t key = pmt::string_to_symbol("wifi_start"); const pmt::pmt_t value = pmt::from_double(freq_offset); diff --git a/lib/utils.h b/lib/utils.h index d1481b8..be18f65 100644 --- a/lib/utils.h +++ b/lib/utils.h @@ -32,10 +32,10 @@ using gr::ieee802_11::Encoding; #define MAX_ENCODED_BITS ((16 + 8 * MAX_PSDU_SIZE + 6) * 2 + MAX_BITS_PER_SYM) #define dout d_debug&& std::cout -#define mylog(msg) \ +#define mylog(...) \ do { \ if (d_log) { \ - GR_LOG_INFO(d_logger, msg); \ + d_logger->info(__VA_ARGS__); \ } \ } while (0);