commit | 46a2e0efddf4e2d55f77f6fba7f09a9f2987c02b | [log] [tgz] |
---|---|---|
author | Tom Cherry <tomcherry@google.com> | Fri Jan 10 17:18:55 2020 -0800 |
committer | Tom Cherry <tomcherry@google.com> | Mon Jan 13 09:29:15 2020 -0800 |
tree | 3380f15f62997930f9b3e618218bb564f87daf74 | |
parent | 1be1f9146b7bc2a0334ab6f9e4c1c983077f0514 [diff] |
base: remove LOG_TO(), PLOG_TO() and LOG_STREAM_TO() macros There were only two users of these and both of them were better off setting up a default logger. These macros are not particularly useful as it's not useful for a single program to write to both the MAIN and SYSTEM logs. In fact, the opposite of these macros would be more beneficial: having more programs write to only the MAIN or only the SYSTEM buffer, so getting rid of these macros removes a temptation for bad behavior. Users that absolutely need to do this behavior can still use the liblog macros or functions, but that should be an extreme edge case, such as the few programs that write to the CRASH buffer and does not need to exist in libbase. Bug: 119867234 Test: build Change-Id: I23369c3b48ed636b617220cab47f77fdd5559763
This library is a collection of convenience functions to make common tasks easier and less error-prone.
In this context, "error-prone" covers both "hard to do correctly" and "hard to do with good performance", but as a general purpose library, libbase's primary focus is on making it easier to do things easily and correctly when a compromise has to be made between "simplest API" on the one hand and "fastest implementation" on the other. Though obviously the ideal is to have both.
The intention is to cover the 80% use cases, not be all things to all users.
If you have a routine that's really useful in your project, congratulations. But that doesn't mean it should be here rather than just in your project.
The question for libbase is "should everyone be doing this?"/"does this make everyone's code cleaner/safer?". Historically we've considered the bar for inclusion to be "are there at least three unrelated projects that would be cleaned up by doing so".
If your routine is actually something from a future C++ standard (that isn't yet in libc++), or it's widely used in another library, that helps show that there's precedent. Being able to say "so-and-so has used this API for n years" is a good way to reduce concerns about API choices.
Unlike most Android code, code in libbase has to build for Mac and Windows too.
Code here is also expected to have good test coverage.
By its nature, it's difficult to change libbase API. It's often best to start using your routine just in your project, and let it "graduate" after you're certain that the API is solid.