Skip to content
Snippets Groups Projects
  • Henri Chataing's avatar
    e08cbed3
    system: fmtlib logger implementation · e08cbed3
    Henri Chataing authored
    - 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
    e08cbed3
    History
    system: fmtlib logger implementation
    Henri Chataing authored
    - 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
Code owners
Assign users and groups as approvers for specific file changes. Learn more.