80 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
			
		
		
	
	
			80 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
| Upstream: no
 | |
| 
 | |
| Honestly, I don't care much. I tries to print as much as it makes sense
 | |
| --- a/gnuradio-runtime/include/gnuradio/logger.h
 | |
| +++ b/gnuradio-runtime/include/gnuradio/logger.h
 | |
| @@ -37,6 +37,9 @@ using logger_ptr = std::shared_ptr<void>
 | |
|  #include <spdlog/fmt/fmt.h>
 | |
|  #include <spdlog/fmt/ostr.h>
 | |
|  #include <memory>
 | |
| +#include <string>
 | |
| +#include <type_traits>
 | |
| +#include <utility>
 | |
|  
 | |
|  #include <spdlog/spdlog.h>
 | |
|  
 | |
| @@ -285,6 +288,52 @@ struct fmt::formatter<boost::format> : f
 | |
|      }
 | |
|  };
 | |
|  
 | |
| +namespace fmt {
 | |
| +template <typename T>
 | |
| +struct formatter<
 | |
| +    T,
 | |
| +    typename std::enable_if<
 | |
| +        std::is_convertible<
 | |
| +            decltype(std::declval<T>().identifier()),
 | |
| +            std::string
 | |
| +        >::value,
 | |
| +        char
 | |
| +    >::type > : fmt::formatter<std::string> {
 | |
| +    template <typename FormatCtx>
 | |
| +    auto format(const T& value, FormatCtx& ctx)
 | |
| +        -> decltype(fmt::formatter<std::string>::format(value.identifier(), ctx))
 | |
| +    {
 | |
| +        return fmt::formatter<std::string>::format(value.identifier(), ctx);
 | |
| +    }
 | |
| +};
 | |
| +template <typename T, typename Ch>
 | |
| +struct formatter<std::shared_ptr<T>, Ch> : fmt::formatter<const void *, Ch> {
 | |
| +    template <typename FormatCtx>
 | |
| +    auto format(const std::shared_ptr<T>& ptr, FormatCtx& ctx)
 | |
| +        -> decltype(fmt::formatter<const void *, Ch>::format(fmt::ptr(ptr), ctx))
 | |
| +    {
 | |
| +        return fmt::formatter<const void *, Ch>::format(fmt::ptr(ptr), ctx);
 | |
| +    }
 | |
| +};
 | |
| +template <typename T>
 | |
| +struct formatter<
 | |
| +    std::shared_ptr<T>,
 | |
| +    typename std::enable_if<
 | |
| +        std::is_convertible<
 | |
| +            decltype(std::declval<T>().identifier()),
 | |
| +            std::string
 | |
| +        >::value,
 | |
| +        char
 | |
| +    >::type > : fmt::formatter<std::string> {
 | |
| +    template <typename FormatCtx>
 | |
| +    auto format(const std::shared_ptr<T>& ptr, FormatCtx& ctx)
 | |
| +        -> decltype(fmt::formatter<std::string>::format(ptr->identifier(), ctx))
 | |
| +    {
 | |
| +        return fmt::formatter<std::string>::format(ptr->identifier(), ctx);
 | |
| +    }
 | |
| +};
 | |
| +}
 | |
| +
 | |
|  #endif
 | |
|  
 | |
|  #endif /* INCLUDED_GR_LOGGER_H */
 | |
| --- a/gnuradio-runtime/python/gnuradio/gr/bindings/logger_python.cc
 | |
| +++ b/gnuradio-runtime/python/gnuradio/gr/bindings/logger_python.cc
 | |
| @@ -15,7 +15,7 @@
 | |
|  /* BINDTOOL_GEN_AUTOMATIC(0)                                                       */
 | |
|  /* BINDTOOL_USE_PYGCCXML(0)                                                        */
 | |
|  /* BINDTOOL_HEADER_FILE(logger.h)                                        */
 | |
| -/* BINDTOOL_HEADER_FILE_HASH(a76c325b045da079c83e294cc4abb8c6)                     */
 | |
| +/* BINDTOOL_HEADER_FILE_HASH(0e6a6ba08242e117ab4407ef3bf7afdf)                     */
 | |
|  /***********************************************************************************/
 | |
|  
 | |
|  #include <pybind11/complex.h>
 | 
