Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e08cbed3 authored by Henri Chataing's avatar Henri Chataing
Browse files

system: fmtlib logger implementation

- The fmtlib logger is implemented in <bluetooth/log.h>.
  The header defines the following templated logs function:

    template<typename T...>
    log::fatal(fmt::format_string<T...> fmt, T...args);
    log::error(..);
    log::warn(..);
    log::info(..);
    log::debug(..);
    log::verbose(..);

- Front-end, logs are printed out by invoking these
  macros with the macro LOG_TAG defined _before_ the
  inclusion of #include <bluetooth/log.h>

- Back-end, a single method must be implemented for all supported
  platforms (android, floss, host):

  namespace log_internal {
  void vlog(Level level, char const *tag, char const *file_name, int line,
            fmt::string_view fmt, fmt::format_args vargs);
  }

- Default implementations are provided:
  + vlog_android: outputs to <log/log.h> __android_log_write_log_message
  + vlog_syslog: outputs to <syslog.h> syslog

Bug: 305066880
Test: m libbluetooth_log
Test: atest libbluetooth_log_test
Flag: EXEMPT, logging utils
Change-Id: Ic8a80f113b25d874c372d7dce8252d5428842ee8
parent faa70d82
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ sudo apt-get install repo git-core gnupg flex bison gperf build-essential \
  libgl1-mesa-dev libxml2-utils xsltproc unzip liblz4-tool libssl-dev \
  libc++-dev libevent-dev \
  flatbuffers-compiler libflatbuffers1 openssl \
  libflatbuffers-dev libtinyxml2-dev \
  libflatbuffers-dev libfmt-dev libtinyxml2-dev \
  libglib2.0-dev libevent-dev libnss3-dev libdbus-1-dev \
  libprotobuf-dev ninja-build generate-ninja protobuf-compiler \
  libre2-9 debmake \
+1 −0
Original line number Diff line number Diff line
@@ -127,6 +127,7 @@ REQUIRED_APT_PACKAGES = [
    'liblz4-tool',
    'libncurses5',
    'libnss3-dev',
    'libfmt-dev',
    'libprotobuf-dev',
    'libre2-9',
    'libre2-dev',
+1 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ RUN apt-get update && \
    libdouble-conversion-dev \
    libevent-dev \
    libflatbuffers-dev \
    libfmt-dev \
    libgl1-mesa-dev \
    libglib2.0-dev \
    libgtest-dev \
+8 −0
Original line number Diff line number Diff line
@@ -174,6 +174,10 @@ config("external_flatbuffers") {
  libs = [ "flatbuffers" ]
}

config("external_fmtlib") {
  configs = [ ":pkg_fmtlib" ]
}

# Package configurations to extract dependencies from env
pkg_config("pkg_gtest") {
  pkg_deps = [ "gtest" ]
@@ -203,6 +207,10 @@ pkg_config("pkg_tinyxml2") {
  pkg_deps = [ "tinyxml2" ]
}

pkg_config("pkd_fmtlib") {
  pkg_deps = [ "fmt" ]
}

# To include ChroemOS-specific libraries and build dependencies.
if (target_os == "chromeos") {
  config("external_chromeos") {
+1 −1
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@ export PATH="${PATH}:${BIN_DIR}"

# Check dependencies
# libchrome requires modp_b64
APT_REQUIRED="modp-b64 libchrome flatbuffers-compiler flex g++-multilib gcc-multilib generate-ninja gnupg gperf libc++-dev libdbus-1-dev libevent-dev libevent-dev libflatbuffers-dev libflatbuffers1 libgl1-mesa-dev libglib2.0-dev liblz4-tool libncurses5 libnss3-dev libprotobuf-dev libre2-9 libssl-dev libtinyxml2-dev libx11-dev libxml2-utils ninja-build openssl protobuf-compiler unzip x11proto-core-dev xsltproc zip zlib1g-dev"
APT_REQUIRED="modp-b64 libchrome flatbuffers-compiler flex g++-multilib gcc-multilib generate-ninja gnupg gperf libc++-dev libdbus-1-dev libevent-dev libevent-dev libflatbuffers-dev libflatbuffers1 libfmt-dev libgl1-mesa-dev libglib2.0-dev liblz4-tool libncurses5 libnss3-dev libprotobuf-dev libre2-9 libssl-dev libtinyxml2-dev libx11-dev libxml2-utils ninja-build openssl protobuf-compiler unzip x11proto-core-dev xsltproc zip zlib1g-dev"

# SPEED UP TEST, REMOVE ME
APT_REQUIRED="modp-b64 libchrome flatbuffers-compiler"
Loading