5#ifndef FLUTTER_FML_LOGGING_H_
6#define FLUTTER_FML_LOGGING_H_
10#include "flutter/fml/log_level.h"
11#include "flutter/fml/macros.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_;
67#define FML_LOG_STREAM(severity) \
68 ::fml::LogMessage(::fml::LOG_##severity, __FILE__, __LINE__, nullptr).stream()
70#define FML_LAZY_STREAM(stream, condition) \
71 !(condition) ? (void)0 : ::fml::LogMessageVoidify() & (stream)
73#define FML_EAT_STREAM_PARAMETERS(ignored) \
76 : ::fml::LogMessageVoidify() & \
77 ::fml::LogMessage(::fml::kLogFatal, 0, 0, nullptr).stream()
79#define FML_LOG_IS_ON(severity) \
80 (::fml::ShouldCreateLogMessage(::fml::LOG_##severity))
82#define FML_LOG(severity) \
83 FML_LAZY_STREAM(FML_LOG_STREAM(severity), FML_LOG_IS_ON(severity))
85#define FML_CHECK(condition) \
87 ::fml::LogMessage(::fml::kLogFatal, __FILE__, __LINE__, #condition) \
91#define FML_VLOG_IS_ON(verbose_level) \
92 ((verbose_level) <= ::fml::GetVlogVerbosity())
95#define FML_VLOG_STREAM(verbose_level) \
96 ::fml::LogMessage(-verbose_level, __FILE__, __LINE__, nullptr).stream()
98#define FML_VLOG(verbose_level) \
99 FML_LAZY_STREAM(FML_VLOG_STREAM(verbose_level), FML_VLOG_IS_ON(verbose_level))
102#define FML_DLOG(severity) FML_LOG(severity)
103#define FML_DCHECK(condition) FML_CHECK(condition)
105#define FML_DLOG(severity) FML_EAT_STREAM_PARAMETERS(true)
106#define FML_DCHECK(condition) FML_EAT_STREAM_PARAMETERS(condition)
109#define FML_UNREACHABLE() \
111 FML_LOG(ERROR) << "Reached unreachable code."; \
112 ::fml::KillProcess(); \
void operator&(std::ostream &)
LogMessage(LogSeverity severity, const char *file, int line, const char *condition)
static void CaptureNextLog(std::ostringstream *stream)
bool ShouldCreateLogMessage(LogSeverity severity)