Skip to content

Commit

Permalink
pw_log_zephyr: Split tokenize handler into its own config
Browse files Browse the repository at this point in the history
Add flexibility to define pw_log_tokenized_HandleLog outside of pigweed.
Projects may need ability to capture tokenized log.

Change-Id: I880c8e23b3ea18a3b84aedf28d97d62d0485fb48
Signed-off-by: Al Semjonovs <[email protected]>
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/168612
Reviewed-by: Taylor Cramer <[email protected]>
Commit-Queue: Auto-Submit <[email protected]>
  • Loading branch information
asemjonovs authored and CQ Bot Account committed Aug 28, 2023
1 parent 6f78430 commit 0c42501
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 5 deletions.
24 changes: 19 additions & 5 deletions pw_log_zephyr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,33 @@ pw_zephyrize_libraries_ifdef(CONFIG_PIGWEED_LOG_ZEPHYR
pw_log_zephyr
)

pw_add_library(pw_log_zephyr.tokenized_handler STATIC
pw_add_library(pw_log_zephyr.tokenized_lib INTERFACE
HEADERS
zephyr_public_overrides/zephyr_custom_log.h
SOURCES
pw_log_zephyr_tokenized_handler.cc
PUBLIC_DEPS
pw_log_tokenized.base64
pw_log_tokenized.handler
pw_span
pw_sync.interrupt_spin_lock
pw_tokenizer
pw_tokenizer.base64
)

pw_zephyrize_libraries_ifdef(CONFIG_PIGWEED_LOG_TOKENIZED_LIB
pw_log.facade
pw_log_tokenized
)
if(CONFIG_PIGWEED_LOG_TOKENIZED_LIB)
zephyr_include_directories(zephyr_public_overrides)
endif()

pw_add_library(pw_log_zephyr.tokenized_handler STATIC
SOURCES
pw_log_zephyr_tokenized_handler.cc
PUBLIC_DEPS
pw_log_tokenized.handler
pw_log_zephyr.tokenized_lib
)

pw_zephyrize_libraries_ifdef(CONFIG_PIGWEED_LOG_TOKENIZED
pw_log.facade
pw_log_tokenized
Expand Down Expand Up @@ -80,4 +94,4 @@ endif()
pw_set_config_from_zephyr(CONFIG_PIGWEED_LOG_TOKENIZED_LEVEL_BITS PW_LOG_TOKENIZED_LEVEL_BITS)
pw_set_config_from_zephyr(CONFIG_PIGWEED_LOG_TOKENIZED_LINE_BITS PW_LOG_TOKENIZED_LINE_BITS)
pw_set_config_from_zephyr(CONFIG_PIGWEED_LOG_TOKENIZED_FLAG_BITS PW_LOG_TOKENIZED_FLAG_BITS)
pw_set_config_from_zephyr(CONFIG_PIGWEED_LOG_TOKENIZED_MODULE_BITS PW_LOG_TOKENIZED_MODULE_BITS)
pw_set_config_from_zephyr(CONFIG_PIGWEED_LOG_TOKENIZED_MODULE_BITS PW_LOG_TOKENIZED_MODULE_BITS)
12 changes: 12 additions & 0 deletions pw_log_zephyr/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,18 @@ menuconfig PIGWEED_LOG_TOKENIZED
automatically tokenize all the logging strings. This means that Pigweed
will also tokenize all of Zephyr's logging statements.

config PIGWEED_LOG_TOKENIZED_LIB
bool "Tokenize logging and implement your own pw_log_tokenized_HandleLog"
select PIGWEED_PREPROCESSOR
select PIGWEED_SYNC_INTERRUPT_SPIN_LOCK
select PIGWEED_SYS_IO
select PIGWEED_TOKENIZER
select LOG_CUSTOM_HEADER
help
Same as PIGWEED_LOG_TOKENIZED but you'll need to implement
pw_log_tokenized_HandleLog. This gives you flexiblity to access handlers
outside of pigweed.

config PIGWEED_LOG_NONE
bool "Do not use pigweed logging"
help
Expand Down

0 comments on commit 0c42501

Please sign in to comment.