Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
accessibility
base
logging.h
Go to the documentation of this file.
1
// Copyright 2013 The Flutter Authors. All rights reserved.
2
// Use of this source code is governed by a BSD-style license that can be
3
// found in the LICENSE file.
4
5
#ifndef ACCESSIBILITY_BASE_LOGGING_H_
6
#define ACCESSIBILITY_BASE_LOGGING_H_
7
8
#include <sstream>
9
10
#include "
macros.h
"
11
12
namespace
base
{
13
14
class
LogMessageVoidify
{
15
public
:
16
void
operator&
(std::ostream&) {}
17
};
18
19
class
LogMessage
{
20
public
:
21
LogMessage
(
const
char
* file,
22
int
line,
23
const
char
* condition,
24
bool
killProcess);
25
~LogMessage
();
26
27
std::ostream&
stream
() {
return
stream_; }
28
29
private
:
30
std::ostringstream stream_;
31
const
char
* file_;
32
const
int
line_;
33
const
bool
killProcess_;
34
35
BASE_DISALLOW_COPY_AND_ASSIGN
(
LogMessage
);
36
};
37
38
[[noreturn]]
void
KillProcess
();
39
40
}
// namespace base
41
42
#define BASE_LOG_STREAM() \
43
::base::LogMessage(__FILE__, __LINE__, nullptr, false).stream()
44
45
#define BASE_LAZY_STREAM(stream, condition) \
46
!(condition) ? (void)0 : ::base::LogMessageVoidify() & (stream)
47
48
#define BASE_EAT_STREAM_PARAMETERS(ignored) \
49
true || (ignored) \
50
? (void)0 \
51
: ::base::LogMessageVoidify() & \
52
::base::LogMessage(0, 0, nullptr, !(ignored)).stream()
53
54
#define BASE_LOG() BASE_LAZY_STREAM(BASE_LOG_STREAM(), true)
55
56
#define BASE_CHECK(condition) \
57
BASE_LAZY_STREAM( \
58
::base::LogMessage(__FILE__, __LINE__, #condition, true).stream(), \
59
!(condition))
60
61
#ifndef NDEBUG
62
#define BASE_DLOG() BASE_LOG()
63
#define BASE_DCHECK(condition) BASE_CHECK(condition)
64
#else
65
#define BASE_DLOG() BASE_EAT_STREAM_PARAMETERS(true)
66
#define BASE_DCHECK(condition) BASE_EAT_STREAM_PARAMETERS(condition)
67
#endif
68
69
#define BASE_UNREACHABLE() \
70
{ \
71
BASE_LOG() << "Reached unreachable code."; \
72
::base::KillProcess(); \
73
}
74
75
#endif
// ACCESSIBILITY_BASE_LOGGING_H_
base::LogMessageVoidify
Definition
logging.h:14
base::LogMessageVoidify::operator&
void operator&(std::ostream &)
Definition
logging.h:16
base::LogMessage
Definition
logging.h:19
base::LogMessage::stream
std::ostream & stream()
Definition
logging.h:27
base::LogMessage::~LogMessage
~LogMessage()
Definition
logging.cc:45
base
Definition
ax_tree_id_registry.h:17
base::KillProcess
void KillProcess()
Definition
logging.cc:61
BASE_DISALLOW_COPY_AND_ASSIGN
#define BASE_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition
macros.h:8
macros.h
Generated on Fri Apr 26 2024 06:14:05 for Flutter Engine by
1.9.8