| 229 | : data_(new LogMessageData(file, line, severity, tag, error)) {} |
| 230 | |
| 231 | LogMessage::~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 | |
| 259 | std::ostream& LogMessage::stream() { return data_->GetBuffer(); } |
| 260 |
nothing calls this directly
no test coverage detected