Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ config BLUETOOTH_SERVICE_LOG_LEVEL
default 7
depends on BLUETOOTH_SERVICE
help
Set BT Service log level <0~7>
Set BT Service log level <0~8>
endif #BLUETOOTH_LOG

endmenu #Debug
Expand Down
11 changes: 11 additions & 0 deletions service/utils/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ enum bt_log_level_ {
BT_LOG_LEVEL_WARNING = LOG_WARNING,
BT_LOG_LEVEL_INFO = LOG_INFO,
BT_LOG_LEVEL_DEBUG = LOG_DEBUG,
BT_LOG_LEVEL_VERBOSE,
};

#ifndef CONFIG_BLUETOOTH_SERVICE_LOG_LEVEL
Expand All @@ -51,6 +52,7 @@ enum bt_log_level_ {
#define BT_LOGW(fmt, args...)
#define BT_LOGI(fmt, args...)
#define BT_LOGD(fmt, args...)
#define BT_LOGV(fmt, args...)
#else
extern bool bt_log_print_check(uint8_t level);

Expand Down Expand Up @@ -81,6 +83,15 @@ extern bool bt_log_print_check(uint8_t level);
if (bt_log_print_check(BT_LOG_LEVEL_DEBUG)) \
BT_LOG(LOG_ID_FRAMEWORK, BT_LOG_LEVEL_DEBUG, fmt, ##__VA_ARGS__); \
} while (0);
#if CONFIG_BLUETOOTH_SERVICE_LOG_LEVEL < 7

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is #if CONFIG_BLUETOOTH_SERVICE_LOG_LEVEL <= 7 or #if CONFIG_BLUETOOTH_SERVICE_LOG_LEVEL < 8?

#define BT_LOGV(fmt, args...)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we handle the case like BT_LOGD? as LINE:55 code does

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it would create too many conditional branches in production, slowing down the system.

#else
#define BT_LOGV(fmt, ...) \
do { \
if (bt_log_print_check(BT_LOG_LEVEL_VERBOSE)) \
BT_LOG(LOG_ID_FRAMEWORK, BT_LOG_LEVEL_DEBUG, fmt, ##__VA_ARGS__); \
} while (0);
#endif
#endif

#define BT_ADDR_LOG(fmt, _addr, ...) \
Expand Down
Loading