The LogdLogger sends chunks of up to ~4000 bytes at a time to logd. It does not prevent other threads from writing to logd between sending each chunk, so other threads may interleave their messages. If preventing interleaving is required, then a custom logger that takes a lock before calling this logger should be provided.
| 125 | // required, then a custom logger that takes a lock before calling this logger |
| 126 | // should be provided. |
| 127 | class LogdLogger { |
| 128 | public: |
| 129 | explicit LogdLogger(LogId default_log_id = ndksamples::base::MAIN); |
| 130 | |
| 131 | void operator()(LogId, LogSeverity, const char* tag, const char* file, |
| 132 | unsigned int line, const char* message); |
| 133 | |
| 134 | private: |
| 135 | LogId default_log_id_; |
| 136 | }; |
| 137 | |
| 138 | // Configure logging based on ANDROID_LOG_TAGS environment variable. |
| 139 | // We need to parse a string that looks like |