diff options
| -rw-r--r-- | host/include/uhd/utils/log.hpp | 3 | ||||
| -rw-r--r-- | host/lib/convert/convert_impl.cpp | 6 | ||||
| -rw-r--r-- | host/lib/transport/libusb1_zero_copy.cpp | 4 | ||||
| -rw-r--r-- | host/lib/transport/udp_simple.cpp | 4 | ||||
| -rw-r--r-- | host/lib/transport/udp_zero_copy.cpp | 13 | ||||
| -rw-r--r-- | host/lib/usrp/dboard_eeprom.cpp | 20 | ||||
| -rw-r--r-- | host/lib/usrp/dboard_manager.cpp | 4 | ||||
| -rw-r--r-- | host/lib/utils/gain_group.cpp | 6 | 
8 files changed, 28 insertions, 32 deletions
| diff --git a/host/include/uhd/utils/log.hpp b/host/include/uhd/utils/log.hpp index b3e88f865..9dceea982 100644 --- a/host/include/uhd/utils/log.hpp +++ b/host/include/uhd/utils/log.hpp @@ -23,7 +23,7 @@  #include <ostream>  #include <string> -/*! +/*! \file log.hpp   * The UHD logging facility.   *   * The logger enables UHD library code to easily log events into a file. @@ -35,6 +35,7 @@   * To override <temp-directory>, set the UHD_TEMP_PATH environment variable.   *   * All log messages with verbosity greater than or equal to the log level + * (in other words, as often or less often than the current log level)   * are recorded into the log file. All other messages are sent to null.   *   * The default log level is "regular", but can be overridden: diff --git a/host/lib/convert/convert_impl.cpp b/host/lib/convert/convert_impl.cpp index d43cecfec..9b2cdcdc9 100644 --- a/host/lib/convert/convert_impl.cpp +++ b/host/lib/convert/convert_impl.cpp @@ -16,16 +16,14 @@  //  #include <uhd/convert.hpp> +#include <uhd/utils/log.hpp>  #include <uhd/utils/static.hpp>  #include <uhd/exception.hpp> -#include <iostream>  using namespace uhd;  #include "convert_pred.hpp" -static const bool debug = false; -  /***********************************************************************   * Define types for the function tables   **********************************************************************/ @@ -78,7 +76,7 @@ void uhd::convert::register_converter(      }      //----------------------------------------------------------------// -    if (debug) std::cout << "register_converter: " << markup << std::endl +    UHD_LOGV(always) << "register_converter: " << markup << std::endl          << "    prio: " << prio << std::endl          << "    pred: " << pred << std::endl          << "    dir: " << dir << std::endl diff --git a/host/lib/transport/libusb1_zero_copy.cpp b/host/lib/transport/libusb1_zero_copy.cpp index ec2077d30..d4cfab422 100644 --- a/host/lib/transport/libusb1_zero_copy.cpp +++ b/host/lib/transport/libusb1_zero_copy.cpp @@ -20,13 +20,13 @@  #include <uhd/transport/bounded_buffer.hpp>  #include <uhd/transport/buffer_pool.hpp>  #include <uhd/utils/thread_priority.hpp> +#include <uhd/utils/log.hpp>  #include <uhd/exception.hpp>  #include <boost/function.hpp>  #include <boost/foreach.hpp>  #include <boost/thread/thread.hpp>  #include <boost/thread/barrier.hpp>  #include <list> -#include <iostream>  using namespace uhd;  using namespace uhd::transport; @@ -52,7 +52,7 @@ static void LIBUSB_CALL libusb_async_cb(libusb_transfer *lut){  //! callback to free transfer upon cancellation  static void LIBUSB_CALL cancel_transfer_cb(libusb_transfer *lut){      if (lut->status == LIBUSB_TRANSFER_CANCELLED) libusb_free_transfer(lut); -    else std::cout << "libusb cancel_transfer unexpected status " << lut->status << std::endl; +    else UHD_LOGV(rarely) << "libusb cancel_transfer unexpected status " << lut->status << std::endl;  }  /*********************************************************************** diff --git a/host/lib/transport/udp_simple.cpp b/host/lib/transport/udp_simple.cpp index 1ee036d52..ed778fbf4 100644 --- a/host/lib/transport/udp_simple.cpp +++ b/host/lib/transport/udp_simple.cpp @@ -17,8 +17,8 @@  #include "udp_common.hpp"  #include <uhd/transport/udp_simple.hpp> +#include <uhd/utils/log.hpp>  #include <boost/format.hpp> -#include <iostream>  using namespace uhd::transport;  namespace asio = boost::asio; @@ -31,7 +31,7 @@ public:      udp_simple_impl(          const std::string &addr, const std::string &port, bool bcast, bool connect      ):_connected(connect){ -        //std::cout << boost::format("Creating udp transport for %s %s") % addr % port << std::endl; +        UHD_LOG << boost::format("Creating udp transport for %s %s") % addr % port << std::endl;          //resolve the address          asio::ip::udp::resolver resolver(_io_service); diff --git a/host/lib/transport/udp_zero_copy.cpp b/host/lib/transport/udp_zero_copy.cpp index 5810f441c..15d882676 100644 --- a/host/lib/transport/udp_zero_copy.cpp +++ b/host/lib/transport/udp_zero_copy.cpp @@ -21,8 +21,8 @@  #include <uhd/transport/bounded_buffer.hpp>  #include <uhd/transport/buffer_pool.hpp>  #include <uhd/utils/warning.hpp> +#include <uhd/utils/log.hpp>  #include <boost/format.hpp> -#include <iostream>  #include <list>  using namespace uhd; @@ -131,7 +131,7 @@ public:          _pending_recv_buffs(_num_recv_frames),          _pending_send_buffs(_num_send_frames)      { -        //std::cout << boost::format("Creating udp transport for %s %s") % addr % port << std::endl; +        UHD_LOG << boost::format("Creating udp transport for %s %s") % addr % port << std::endl;          //resolve the address          asio::ip::udp::resolver resolver(_io_service); @@ -275,17 +275,16 @@ template<typename Opt> static void resize_buff_helper(      //resize the buffer if size was provided      if (target_size > 0){          size_t actual_size = udp_trans->resize_buff<Opt>(target_size); -        if (target_size != actual_size) std::cout << boost::format( +        UHD_LOG << boost::format(              "Target %s sock buff size: %d bytes\n"              "Actual %s sock buff size: %d bytes"          ) % name % target_size % name % actual_size << std::endl; -        else std::cout << boost::format( -            "Current %s sock buff size: %d bytes" -        ) % name % actual_size << std::endl;          if (actual_size < target_size) uhd::warning::post(str(boost::format(              "The %s buffer could not be resized sufficiently.\n" +            "Target sock buff size: %d bytes.\n" +            "Actual sock buff size: %d bytes.\n"              "See the transport application notes on buffer resizing.\n%s" -        ) % name % help_message)); +        ) % name % target_size % actual_size % help_message));      }  } diff --git a/host/lib/usrp/dboard_eeprom.cpp b/host/lib/usrp/dboard_eeprom.cpp index c1e44fb74..0dc3471f7 100644 --- a/host/lib/usrp/dboard_eeprom.cpp +++ b/host/lib/usrp/dboard_eeprom.cpp @@ -17,16 +17,15 @@  #include <uhd/usrp/dboard_eeprom.hpp>  #include <uhd/exception.hpp> +#include <uhd/utils/log.hpp>  #include <boost/foreach.hpp>  #include <boost/format.hpp>  #include <algorithm> -#include <iostream> +#include <sstream>  using namespace uhd;  using namespace uhd::usrp; -static const bool _dboard_eeprom_debug = false; -  /***********************************************************************   * Utility functions   **********************************************************************/ @@ -91,8 +90,7 @@ static boost::uint8_t checksum(const byte_vector_t &bytes){      for (size_t i = 0; i < std::min(bytes.size(), size_t(DB_EEPROM_CHKSUM)); i++){          sum -= int(bytes.at(i));      } -    if (_dboard_eeprom_debug) -        std::cout << boost::format("sum: 0x%02x") % sum << std::endl; +    UHD_LOGV(often) << boost::format("sum: 0x%02x") % sum << std::endl;      return boost::uint8_t(sum);  } @@ -104,13 +102,13 @@ dboard_eeprom_t::dboard_eeprom_t(void){  void dboard_eeprom_t::load(i2c_iface &iface, boost::uint8_t addr){      byte_vector_t bytes = iface.read_eeprom(addr, 0, DB_EEPROM_CLEN); -    if (_dboard_eeprom_debug){ -        for (size_t i = 0; i < bytes.size(); i++){ -            std::cout << boost::format( -                "eeprom byte[0x%02x] = 0x%02x") % i % int(bytes.at(i) -            ) << std::endl; -        } +    std::ostringstream ss; +    for (size_t i = 0; i < bytes.size(); i++){ +        ss << boost::format( +            "eeprom byte[0x%02x] = 0x%02x") % i % int(bytes.at(i) +        ) << std::endl;      } +    UHD_LOGV(often) << ss.str() << std::endl;      try{          UHD_ASSERT_THROW(bytes.size() >= DB_EEPROM_CLEN); diff --git a/host/lib/usrp/dboard_manager.cpp b/host/lib/usrp/dboard_manager.cpp index 2e8b39311..cd934dd0d 100644 --- a/host/lib/usrp/dboard_manager.cpp +++ b/host/lib/usrp/dboard_manager.cpp @@ -19,6 +19,7 @@  #include <uhd/usrp/dboard_manager.hpp>  #include <uhd/usrp/subdev_props.hpp>  #include <uhd/utils/warning.hpp> +#include <uhd/utils/log.hpp>  #include <uhd/utils/static.hpp>  #include <uhd/exception.hpp>  #include <uhd/types/dict.hpp> @@ -27,7 +28,6 @@  #include <boost/bind.hpp>  #include <boost/foreach.hpp>  #include <boost/assign/list_of.hpp> -#include <iostream>  using namespace uhd;  using namespace uhd::usrp; @@ -91,7 +91,7 @@ static void register_dboard_key(      const std::string &name,      const prop_names_t &subdev_names  ){ -    //std::cout << "registering: " << name << std::endl; +    UHD_LOGV(always) << "registering: " << name << std::endl;      if (get_id_to_args_map().has_key(dboard_key)){          if (dboard_key.is_xcvr()) throw uhd::key_error(str(boost::format( diff --git a/host/lib/utils/gain_group.cpp b/host/lib/utils/gain_group.cpp index 3af8a543d..85f4977a6 100644 --- a/host/lib/utils/gain_group.cpp +++ b/host/lib/utils/gain_group.cpp @@ -16,6 +16,7 @@  //  #include <uhd/utils/gain_group.hpp> +#include <uhd/utils/log.hpp>  #include <uhd/types/dict.hpp>  #include <uhd/utils/algorithm.hpp>  #include <uhd/exception.hpp> @@ -23,7 +24,6 @@  #include <boost/bind.hpp>  #include <algorithm>  #include <vector> -#include <iostream>  using namespace uhd; @@ -137,11 +137,11 @@ public:              gain_bucket.at(i) += additional_gain;              gain_left_to_distribute -= additional_gain;          } -        if (verbose) std::cout << "gain_left_to_distribute " << gain_left_to_distribute << std::endl; +        UHD_LOGV(often) << "gain_left_to_distribute " << gain_left_to_distribute << std::endl;          //now write the bucket out to the individual gain values          for (size_t i = 0; i < gain_bucket.size(); i++){ -            if (verbose) std::cout << gain_bucket.at(i) << std::endl; +            UHD_LOGV(often) << i << ": " << gain_bucket.at(i) << std::endl;              all_fcns.at(i).set_value(gain_bucket.at(i));          }      } | 
