9 #ifndef INCLUDE_FUNAPI_SYSTEM_LOGGING_H_ 10 #define INCLUDE_FUNAPI_SYSTEM_LOGGING_H_ 12 #include <boost/noncopyable.hpp> 13 #include <boost/shared_ptr.hpp> 14 #include <boost/uuid/uuid.hpp> 16 #include <glog/logging.h> 22 #define LOW_CONCAT_HELPER(a, b) a##b 23 #define LOW_CONCAT(a, b) LOW_CONCAT_HELPER(a, b) 24 #define LOW_COUNT1 LOW_CONCAT(log_count1_, __LINE__) 25 #define LOW_COUNT2 LOW_CONCAT(log_count2_, __LINE__) 26 #define LOW_LAST LOW_CONCAT(log_last_, __LINE__) 27 #define LOW_GET_CTXT LOW_CONCAT(get_ctxt_, __LINE__) 30 #define LOG_ONCE_WHILE(lv, interval) \ 31 static size_t LOW_COUNT1 = 0; \ 32 static size_t LOW_COUNT2 = 0; \ 33 static MonotonicClock::Value LOW_LAST = 0; \ 34 static function<bool()> LOW_GET_CTXT = []( ) { \ 36 if ((MonotonicClock::Now() - LOW_LAST) >= (interval * 1000 * 1000)) { \ 37 LOW_LAST = MonotonicClock::Now(); \ 38 LOW_COUNT2 = LOW_COUNT1; \ 44 LOG_IF(lv, LOW_GET_CTXT()) << "(#" << LOW_COUNT2 << ") " 49 enum LogColumnCppType {
59 typedef std::vector<string> LoggerColumnNames;
60 typedef std::vector<string> LoggerColumnValues;
61 typedef std::vector<bool> LoggerColumnQuotes;
62 typedef std::vector<LogColumnCppType> LoggerColumnCppTypes;
78 const LoggerColumnNames &columns,
79 const LoggerColumnCppTypes &types,
80 const LoggerColumnQuotes "es);
85 void LogActivity(
const string &activityType,
const LoggerColumnValues &values);
89 #endif // INCLUDE_FUNAPI_SYSTEM_LOGGING_H_
Helper class to register user-defined activity log.
Definition: logging.h:67