13 #include <absl/base/log_severity.h>
14 #include <absl/strings/str_format.h>
18 using absl::LogSeverity;
32 TDBError(LogSeverity level, std::string &&str):
49 operator std::string()
const {
64 void LogError(LogSeverity severity, std::string &&msg);
106 #define LOG(level, ...) \
108 ::taco::LogError(level, absl::StrFormat("[%s] %s:%d: " \
110 absl::LogSeverityName(level),\
111 ::taco::StripSourcePath(__FILE__), __LINE__\
112 IF_NONEMPTY_COMMA(CADR(__VA_ARGS__), ) CDR(__VA_ARGS__))); \
116 #define LOG(level, ...) \
118 ::taco::LogError(level, absl::StrFormat("[%s] " \
120 absl::LogSeverityName(level) \
121 IF_NONEMPTY_COMMA(CADR(__VA_ARGS__), ) CDR(__VA_ARGS__))); \
std::string m_msg
Definition: logging.h:56
TDBError(LogSeverity level, std::string &&str)
Definition: logging.h:32
LogSeverity m_level
Definition: logging.h:55
constexpr LogSeverity GetSeverity() const
Definition: logging.h:37
const std::string & GetMessage() const
Definition: logging.h:42
constexpr LogSeverity kFatal
Definition: logging.h:22
void SetLogOutput(std::ostream *log_out)
Sets the output stream where the log messages should be printed to.
Definition: logging.cpp:47
constexpr LogSeverity kError
Definition: logging.h:21
void DisableLogPrint()
Disable all log message printing.
Definition: logging.cpp:62
void RestoreLogOutput()
Restores the log output stream to std::cerr.
Definition: logging.cpp:52
constexpr LogSeverity kInfo
Definition: logging.h:19
void ClearSecondaryLogOutput()
Clears the secondary output stream where logs messages additionally prints.
Definition: logging.cpp:73
constexpr const size_t log_msg_max_len
Definition: logging.h:28
constexpr const size_t log_msg_buf_size
Definition: logging.h:24
void SetLogPrintMinSeverity(LogSeverity min_severity)
Sets the minimum severity level of a log message to be printed.
Definition: logging.cpp:57
void SetSecondaryLogOutput(std::ostream *log_out, LogSeverity min_severity)
Sets the secondary output stream where logs messages additionally prints with at least the specified ...
Definition: logging.cpp:67
void LogError(LogSeverity level, std::string &&str)
Logs a message (which may not be an error despite what the name suggests).
Definition: logging.cpp:29
constexpr LogSeverity kWarning
Definition: logging.h:20