Brian Silverman | d6974f4 | 2014-02-14 13:39:21 -0800 | [diff] [blame] | 1 | #include "aos/common/logging/logging_impl.h" |
| 2 | |
| 3 | #include <functional> |
| 4 | |
| 5 | namespace aos { |
| 6 | namespace logging { |
| 7 | |
| 8 | template <class T> |
| 9 | void DoLogStruct(log_level level, const ::std::string &message, |
| 10 | const T &structure) { |
Austin Schuh | 41d709b | 2015-11-21 22:38:46 -0800 | [diff] [blame] | 11 | auto fn = [&structure](char *buffer) |
| 12 | -> size_t { return structure.Serialize(buffer); }; |
| 13 | |
Brian Silverman | d6974f4 | 2014-02-14 13:39:21 -0800 | [diff] [blame] | 14 | LogImplementation::DoLogStruct(level, message, T::Size(), T::GetType(), |
Austin Schuh | 41d709b | 2015-11-21 22:38:46 -0800 | [diff] [blame] | 15 | ::std::ref(fn), 1); |
Brian Silverman | d6974f4 | 2014-02-14 13:39:21 -0800 | [diff] [blame] | 16 | } |
| 17 | |
| 18 | } // namespace logging |
| 19 | } // namespace aos |