diff --git a/universal7885-common/apps/aidl-support/libfileio/Android.bp b/universal7885-common/apps/aidl-support/libfileio/Android.bp index 8353de0..a86a4d9 100644 --- a/universal7885-common/apps/aidl-support/libfileio/Android.bp +++ b/universal7885-common/apps/aidl-support/libfileio/Android.bp @@ -4,6 +4,7 @@ cc_library_shared { cppflags: ["-fexceptions"], local_include_dirs: ["include"], export_include_dirs: ["include"], - shared_libs: ["liblog"], + shared_libs: ["libbase"], + header_libs: ["logformat"], } diff --git a/universal7885-common/apps/aidl-support/libfileio/FileIO.cpp b/universal7885-common/apps/aidl-support/libfileio/FileIO.cpp index 9f38851..ee23950 100644 --- a/universal7885-common/apps/aidl-support/libfileio/FileIO.cpp +++ b/universal7885-common/apps/aidl-support/libfileio/FileIO.cpp @@ -1,10 +1,10 @@ -#define LOG_TAG "libFileIO" - -#include +#include #include #include +#include + namespace FileIO { constexpr const int EXIT_ERR = -1; @@ -13,20 +13,20 @@ int readline(const char *path) { std::ifstream file; std::string value; file.open(path); - ALOGD("%s: Opening %s", __func__, path); + LOG(DEBUG) << make_str("%s: Opening %s", __func__, path); if (file.is_open()) { getline(file, value); file.close(); } else { - ALOGE("%s: Failed to open %s", __func__, path); + LOG(ERROR) << make_str("%s: Failed to open %s", __func__, path); return EXIT_ERR; } try { return stoi(value); } catch (std::invalid_argument const &ex) { - ALOGE("%s: stoi(): invalid argument: for %s", __func__, value.c_str()); + LOG(ERROR) << make_str("%s: stoi(): invalid argument: for %s", __func__, value.c_str()); } catch (std::out_of_range const &ex) { - ALOGE("%s: stoi(): out of range: for %s", __func__, value.c_str()); + LOG(ERROR) << make_str("%s: stoi(): out of range: for %s", __func__, value.c_str()); } return EXIT_ERR; } @@ -34,13 +34,13 @@ int readline(const char *path) { void writeline(const char *path, const std::string& data) { std::ofstream file; file.open(path); - ALOGD("%s: Opening %s, will write '%s'", __func__, path, data.c_str()); + LOG(DEBUG) << make_str("%s: Opening %s, will write '%s'", __func__, path, data.c_str()); if (file.is_open()) { file << data; file.close(); return; } - ALOGE("%s: Failed to open %s", __func__, path); + LOG(ERROR) << make_str("%s: Failed to open %s", __func__, path); } void writeline(const char *path, const int data) {