1 #ifndef CombineTools_Logging_h
2 #define CombineTools_Logging_h
9 #define FNERROR(x) ch::FnError(x, __FILE__, __LINE__, __PRETTY_FUNCTION__)
11 #define LOGLINE(x, y) LogLine(x, __func__, y)
13 #define FNLOG(x) x << "[" << __func__ << "] "
14 #define FNLOGC(x, y) if (y) x << "[" << __func__ << "] "
28 void LogLine(std::ostream& stream, std::string
const& func,
29 std::string
const& message);
37 std::string
FnError(std::string
const& message, std::string
const& file,
38 unsigned line, std::string
const& fn);
67 #define LAUNCH_FUNCTION_TIMER(x, y) \
68 static FnTimer x(ch::GetQualififedName(__PRETTY_FUNCTION__)); \
95 explicit FnTimer(std::string name);
104 std::chrono::time_point<std::chrono::system_clock> start_;
105 std::chrono::time_point<std::chrono::system_clock> end_;
Determine the total amount of time spent in a function.
FnTimer(std::string name)
std::string GetQualififedName(std::string const &str)
Extracts the fully-qualified function name from a complete function signature.
void LogLine(std::ostream &stream, std::string const &func, std::string const &message)
Writes a logging message to a given ostream.
std::string FnError(std::string const &message, std::string const &file, unsigned line, std::string const &fn)
Generates an error message which includes the name of the calling function and the filename and line ...