MCPcopy Create free account
hub / github.com/android/ndk-samples / ~LogMessage

Method ~LogMessage

base/src/main/cpp/logging.cpp:231–257  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

229 : data_(new LogMessageData(file, line, severity, tag, error)) {}
230
231LogMessage::~LogMessage() {
232 // Check severity again. This is duplicate work wrt/ LOG macros, but not
233 // LOG_STREAM.
234 if (!WOULD_LOG(data_->GetSeverity())) {
235 return;
236 }
237
238 // Finish constructing the message.
239 if (data_->GetError() != -1) {
240 data_->GetBuffer() << ": " << strerror(data_->GetError());
241 }
242 std::string msg(data_->ToString());
243
244 if (data_->GetSeverity() == FATAL) {
245 // Set the bionic abort message early to avoid liblog doing it
246 // with the individual lines, so that we get the whole message.
247 android_set_abort_message(msg.c_str());
248 }
249
250 LogLine(data_->GetFile(), data_->GetLineNumber(), data_->GetSeverity(),
251 data_->GetTag(), msg.c_str());
252
253 // Abort if necessary.
254 if (data_->GetSeverity() == FATAL) {
255 Aborter()(msg.c_str());
256 }
257}
258
259std::ostream& LogMessage::stream() { return data_->GetBuffer(); }
260

Callers

nothing calls this directly

Calls 6

GetSeverityMethod · 0.80
GetErrorMethod · 0.80
GetFileMethod · 0.80
GetLineNumberMethod · 0.80
GetTagMethod · 0.80
ToStringMethod · 0.45

Tested by

no test coverage detected