20 #include <type_traits> 26 #include <glog/logging.h> 32 template <GoogleLoggerStyle>
62 class Clock = std::chrono::high_resolution_clock>
71 : destructionMessage_(
std::
move(msg)),
72 minTimeToLog_(minTimetoLog),
83 if (destructionMessage_) {
84 log(destructionMessage_.value());
92 template <
typename...
Args>
95 return logImpl(
now, to<std::string>(std::forward<Args>(args)...));
98 template <
typename...
Args>
101 return logImpl(
now,
format(std::forward<Args>(args)...).str());
108 auto duration = now -
start_;
109 if (duration >= minTimeToLog_) {
110 logger_(msg, duration);
124 class Clock = std::chrono::high_resolution_clock>
127 const std::chrono::duration<double>& minTimeToLog =
128 std::chrono::duration<double>::zero(),
134 template <GoogleLoggerStyle Style>
142 LOG(
INFO) << msg <<
" in " 145 LOG(
INFO) << msg <<
" in " << sec.count() <<
" seconds";
Optional< std::string > destructionMessage_
std::chrono::steady_clock::time_point now()
constexpr detail::Map< Move > move
AutoTimer(std::string &&msg="", const DoubleSeconds &minTimetoLog=DoubleSeconds::zero(), Logger &&logger=Logger())
DoubleSeconds logImpl(std::chrono::time_point< Clock > now, StringPiece msg)
DoubleSeconds logFormat(Args &&...args)
internal::ArgsMatcher< InnerMatcher > Args(const InnerMatcher &matcher)
—— Concurrent Priority Queue Implementation ——
std::string prettyPrint(double val, PrettyType type, bool addSpace)
constexpr bool empty() const
std::chrono::duration< double > DoubleSeconds
auto makeAutoTimer(std::string &&msg="", const std::chrono::duration< double > &minTimeToLog=std::chrono::duration< double >::zero(), Logger &&logger=Logger())
DoubleSeconds log(StringPiece msg="")
void operator()(StringPiece msg, const std::chrono::duration< double > &sec) const
DoubleSeconds log(Args &&...args)
DoubleSeconds minTimeToLog_
Formatter< false, Args... > format(StringPiece fmt, Args &&...args)