5#ifndef FLUTTER_FML_LOGGING_H_
6#define FLUTTER_FML_LOGGING_H_
20 std::string
str()
const;
23 std::ostringstream stream_;
37 const char* condition);
40 std::ostream&
stream() {
return stream_; }
47 static thread_local std::ostringstream* capture_next_log_stream_;
48 std::ostringstream stream_;
77#if defined(_MSC_VER) && !defined(__clang__)
80 __builtin_unreachable();
86#define FML_LOG_STREAM(severity) \
87 ::fml::LogMessage(::fml::LOG_##severity, __FILE__, __LINE__, nullptr).stream()
89#define FML_LAZY_STREAM(stream, condition) \
90 !(condition) ? (void)0 : ::fml::LogMessageVoidify() & (stream)
92#define FML_EAT_STREAM_PARAMETERS(ignored) \
95 : ::fml::LogMessageVoidify() & \
96 ::fml::LogMessage(::fml::kLogFatal, 0, 0, nullptr).stream()
98#define FML_LOG_IS_ON(severity) \
99 (::fml::ShouldCreateLogMessageConstexpr(::fml::LOG_##severity, true))
101#define FML_LOG(severity) \
102 FML_LAZY_STREAM(FML_LOG_STREAM(severity), FML_LOG_IS_ON(severity))
104#define FML_CHECK(condition) \
106 ::fml::LogMessage(::fml::kLogFatal, __FILE__, __LINE__, #condition) \
110#define FML_VLOG_IS_ON(verbose_level) \
111 ((verbose_level) <= ::fml::GetVlogVerbosity())
114#define FML_VLOG_STREAM(verbose_level) \
115 ::fml::LogMessage(-verbose_level, __FILE__, __LINE__, nullptr).stream()
117#define FML_VLOG(verbose_level) \
118 FML_LAZY_STREAM(FML_VLOG_STREAM(verbose_level), FML_VLOG_IS_ON(verbose_level))
121#define FML_DLOG(severity) FML_LOG(severity)
122#define FML_DCHECK(condition) FML_CHECK(condition)
124#define FML_DLOG(severity) FML_EAT_STREAM_PARAMETERS(true)
125#define FML_DCHECK(condition) FML_EAT_STREAM_PARAMETERS(condition)
128#define FML_UNREACHABLE() \
130 FML_LOG(ERROR) << "Reached unreachable code."; \
131 ::fml::KillProcessConstexpr(true); \
static void CaptureNextLog(std::ostringstream *stream)
void operator&(std::ostream &)
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
bool ShouldCreateLogMessage(LogSeverity severity)
constexpr void KillProcessConstexpr(bool true_arg)
constexpr bool ShouldCreateLogMessageConstexpr(LogSeverity severity, bool true_arg)