MCPcopy Create free account
hub / github.com/CodingGay/BlackDex / ~LogMessage

Method ~LogMessage

Bcore/src/main/cpp/android-base/logging.cpp:423–460  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

421 : LogMessage(file, line, id, severity, nullptr, error) {}
422
423LogMessage::~LogMessage() {
424 // Check severity again. This is duplicate work wrt/ LOG macros, but not LOG_STREAM.
425 if (!WOULD_LOG(data_->GetSeverity())) {
426 return;
427 }
428
429 // Finish constructing the message.
430 if (data_->GetError() != -1) {
431 data_->GetBuffer() << ": " << strerror(data_->GetError());
432 }
433 std::string msg(data_->ToString());
434
435 {
436 // Do the actual logging with the lock held.
437 std::lock_guard<std::mutex> lock(LoggingLock());
438 if (msg.find('\n') == std::string::npos) {
439 LogLine(data_->GetFile(), data_->GetLineNumber(), data_->GetId(), data_->GetSeverity(),
440 data_->GetTag(), msg.c_str());
441 } else {
442 msg += '\n';
443 size_t i = 0;
444 while (i < msg.size()) {
445 size_t nl = msg.find('\n', i);
446 msg[nl] = '\0';
447 LogLine(data_->GetFile(), data_->GetLineNumber(), data_->GetId(), data_->GetSeverity(),
448 data_->GetTag(), &msg[i]);
449 // Undo the zero-termination so we can give the complete message to the aborter.
450 msg[nl] = '\n';
451 i = nl + 1;
452 }
453 }
454 }
455
456 // Abort if necessary.
457 if (data_->GetSeverity() == FATAL) {
458 Aborter()(msg.c_str());
459 }
460}
461
462std::ostream& LogMessage::stream() {
463 return data_->GetBuffer();

Callers

nothing calls this directly

Calls 10

GetSeverityMethod · 0.80
GetErrorMethod · 0.80
GetFileMethod · 0.80
GetLineNumberMethod · 0.80
GetIdMethod · 0.80
GetTagMethod · 0.80
c_strMethod · 0.80
ToStringMethod · 0.45
findMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected