android_system_core/base
Tom Cherry ebf43ad2d8 liblog: correct new APIs per the API review
1) Rename __android_logger_data to __android_log_message and rename
   __android_log_write_logger_data to
   __android_log_write_log_message. Move the const char* message
   argument into __android_log_message.
2) Add @param, @return, and "Available since API level 30." to the
   documentation of new functions.
3) Document that the user defined aborter should but may not abort.
4) Document the line separation is the responsibility of the log
   function provided to __android_log_set_logger().

Bug: 150898477
Test: build, liblog and libbase unit tests
Change-Id: I07c41011ef25b3e7cc4943f3f1e240a2f6aa2802
2020-03-25 18:36:10 +00:00
..
include/android-base base: tag unique_fd::reset as reinitializing for clang-tidy. 2020-03-09 12:32:56 -07:00
tidy base: tag unique_fd::reset as reinitializing for clang-tidy. 2020-03-09 12:32:56 -07:00
.clang-format
Android.bp base: dlopen/dlsym for liblog when SDK_VER <= 29 2020-03-18 17:42:41 +09:00
CPPLINT.cfg
OWNERS
README.md libbase: add a README.md covering the most frequent question. 2019-11-06 09:38:21 -08:00
abi_compatibility.cpp
chrono_utils.cpp
chrono_utils_test.cpp
cmsg.cpp
cmsg_test.cpp
endian_test.cpp
errors_test.cpp
errors_unix.cpp Add header that defines strerror() 2019-08-08 23:31:36 +00:00
errors_windows.cpp
expected_test.cpp Convert system/core to Result::ok() 2020-02-06 17:04:27 +00:00
file.cpp Addressing comments in 1130236. 2019-10-02 16:48:22 -07:00
file_test.cpp Addressing comments in 1130236. 2019-10-02 16:48:22 -07:00
format_benchmark.cpp
liblog_symbols.cpp liblog: correct new APIs per the API review 2020-03-25 18:36:10 +00:00
liblog_symbols.h liblog: correct new APIs per the API review 2020-03-25 18:36:10 +00:00
logging.cpp liblog: correct new APIs per the API review 2020-03-25 18:36:10 +00:00
logging_test.cpp Move default tag from libbase to liblog 2020-01-23 08:39:31 -08:00
macros_test.cpp
mapped_file.cpp Fix SEGV in libziparchive with malformed zip file. 2019-12-17 08:39:09 -08:00
mapped_file_test.cpp Fix SEGV in libziparchive with malformed zip file. 2019-12-17 08:39:09 -08:00
no_destructor_test.cpp base: steal Chromium's NoDestructor. 2019-12-06 13:23:05 -08:00
parsebool.cpp Expose ParseBool from libbase 2019-11-19 13:31:50 -08:00
parsebool_test.cpp Expose ParseBool from libbase 2019-11-19 13:31:50 -08:00
parsedouble_test.cpp
parseint_test.cpp
parsenetaddress.cpp
parsenetaddress_test.cpp
process.cpp Add android::base::GetPids() function to return all pids 2019-07-01 13:55:46 -07:00
process_test.cpp Add android::base::GetPids() function to return all pids 2019-07-01 13:55:46 -07:00
properties.cpp base: add CachedProperty. 2020-02-27 13:56:48 -08:00
properties_test.cpp base: add CachedProperty. 2020-02-27 13:56:48 -08:00
result_test.cpp Merge "Convert system/core to Result::ok()" 2020-02-07 06:14:16 +00:00
scopeguard_test.cpp
stringprintf.cpp
stringprintf_test.cpp
strings.cpp Add absl-like StringReplace. 2019-11-18 16:02:31 -08:00
strings_test.cpp Add absl-like StringReplace. 2019-11-18 16:02:31 -08:00
test_main.cpp
test_utils.cpp
test_utils_test.cpp
threads.cpp
utf8.cpp
utf8_test.cpp

README.md

libbase

Who is this library for?

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.

Should my routine be added?

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.

Any other restrictions?

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.