Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment