xref: /aosp_15_r20/external/pigweed/pw_log_zephyr/Kconfig (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1*61c4878aSAndroid Build Coastguard Worker# Copyright 2021 The Pigweed Authors
2*61c4878aSAndroid Build Coastguard Worker#
3*61c4878aSAndroid Build Coastguard Worker# Licensed under the Apache License, Version 2.0 (the "License"); you may not
4*61c4878aSAndroid Build Coastguard Worker# use this file except in compliance with the License. You may obtain a copy of
5*61c4878aSAndroid Build Coastguard Worker# the License at
6*61c4878aSAndroid Build Coastguard Worker#
7*61c4878aSAndroid Build Coastguard Worker#     https://www.apache.org/licenses/LICENSE-2.0
8*61c4878aSAndroid Build Coastguard Worker#
9*61c4878aSAndroid Build Coastguard Worker# Unless required by applicable law or agreed to in writing, software
10*61c4878aSAndroid Build Coastguard Worker# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11*61c4878aSAndroid Build Coastguard Worker# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12*61c4878aSAndroid Build Coastguard Worker# License for the specific language governing permissions and limitations under
13*61c4878aSAndroid Build Coastguard Worker# the License.
14*61c4878aSAndroid Build Coastguard Worker
15*61c4878aSAndroid Build Coastguard Workermenu "pw_log"
16*61c4878aSAndroid Build Coastguard Worker
17*61c4878aSAndroid Build Coastguard Workerchoice PIGWEED_LOG
18*61c4878aSAndroid Build Coastguard Worker    prompt "Logging backend used"
19*61c4878aSAndroid Build Coastguard Worker    default PIGWEED_LOG_ZEPHYR if CPP
20*61c4878aSAndroid Build Coastguard Worker    default PIGWEED_LOG_NONE
21*61c4878aSAndroid Build Coastguard Worker    help
22*61c4878aSAndroid Build Coastguard Worker      The type of Zephyr pw_log backend to use. See :ref:`module-pw_log` for
23*61c4878aSAndroid Build Coastguard Worker      module details
24*61c4878aSAndroid Build Coastguard Worker
25*61c4878aSAndroid Build Coastguard Workerconfig PIGWEED_LOG_NONE
26*61c4878aSAndroid Build Coastguard Worker    bool "Do not use Pigweed logging"
27*61c4878aSAndroid Build Coastguard Worker    help
28*61c4878aSAndroid Build Coastguard Worker      PW_LOG_ statements will not work.
29*61c4878aSAndroid Build Coastguard Worker
30*61c4878aSAndroid Build Coastguard Workerconfig PIGWEED_LOG_ZEPHYR
31*61c4878aSAndroid Build Coastguard Worker    bool "Zephyr logging for PW_LOG_* statements"
32*61c4878aSAndroid Build Coastguard Worker    select PIGWEED_PREPROCESSOR
33*61c4878aSAndroid Build Coastguard Worker    help
34*61c4878aSAndroid Build Coastguard Worker      Once the Pigweed logging is enabled, all Pigweed logs via PW_LOG_*() will
35*61c4878aSAndroid Build Coastguard Worker      be routed to the Zephyr logging system. This means that:
36*61c4878aSAndroid Build Coastguard Worker      - :c:macro:`PW_LOG_LEVEL_DEBUG` maps to Zephyr's LOG_LEVEL_DBG
37*61c4878aSAndroid Build Coastguard Worker      - :c:macro:`PW_LOG_LEVEL_INFO` maps to Zephyr's LOG_LEVEL_INF
38*61c4878aSAndroid Build Coastguard Worker      - :c:macro:`PW_LOG_LEVEL_WARN` maps to Zephyr's LOG_LEVEL_WRN
39*61c4878aSAndroid Build Coastguard Worker      - :c:macro:`PW_LOG_LEVEL_ERROR` maps to Zephyr's LOG_LEVEL_ERR
40*61c4878aSAndroid Build Coastguard Worker      - :c:macro:`PW_LOG_LEVEL_CRITICAL` maps to Zephyr's LOG_LEVEL_ERR
41*61c4878aSAndroid Build Coastguard Worker      - :c:macro:`PW_LOG_LEVEL_FATAL` maps to Zephyr's LOG_LEVEL_ERR
42*61c4878aSAndroid Build Coastguard Worker
43*61c4878aSAndroid Build Coastguard Workermenuconfig PIGWEED_LOG_TOKENIZED
44*61c4878aSAndroid Build Coastguard Worker    bool "Maps all Zephyr log macros to tokenized PW_LOG_* macros"
45*61c4878aSAndroid Build Coastguard Worker    select PIGWEED_PREPROCESSOR
46*61c4878aSAndroid Build Coastguard Worker    select PIGWEED_SYNC_INTERRUPT_SPIN_LOCK
47*61c4878aSAndroid Build Coastguard Worker    select PIGWEED_SYS_IO
48*61c4878aSAndroid Build Coastguard Worker    select PIGWEED_TOKENIZER
49*61c4878aSAndroid Build Coastguard Worker    select LOG_CUSTOM_HEADER
50*61c4878aSAndroid Build Coastguard Worker    select SHELL_CUSTOM_HEADER
51*61c4878aSAndroid Build Coastguard Worker    help
52*61c4878aSAndroid Build Coastguard Worker      Map all the Zephyr log macros to use Pigweed's then use the
53*61c4878aSAndroid Build Coastguard Worker      :ref:`module-pw_log_tokenized` target as the logging backend in order to
54*61c4878aSAndroid Build Coastguard Worker      automatically tokenize all the logging strings. This means that Pigweed
55*61c4878aSAndroid Build Coastguard Worker      will also tokenize all of Zephyr's logging statements.
56*61c4878aSAndroid Build Coastguard Worker
57*61c4878aSAndroid Build Coastguard Workerconfig PIGWEED_LOG_TOKENIZED_LIB
58*61c4878aSAndroid Build Coastguard Worker    bool "Tokenize logging and implement your own pw_log_tokenized_HandleLog"
59*61c4878aSAndroid Build Coastguard Worker    select PIGWEED_TOKENIZER
60*61c4878aSAndroid Build Coastguard Worker    select LOG_CUSTOM_HEADER
61*61c4878aSAndroid Build Coastguard Worker    select SHELL_CUSTOM_HEADER
62*61c4878aSAndroid Build Coastguard Worker    help
63*61c4878aSAndroid Build Coastguard Worker      Same as PIGWEED_LOG_TOKENIZED but you'll need to implement
64*61c4878aSAndroid Build Coastguard Worker      pw_log_tokenized_HandleLog. This gives you flexiblity to access handlers
65*61c4878aSAndroid Build Coastguard Worker      outside of pigweed.
66*61c4878aSAndroid Build Coastguard Worker
67*61c4878aSAndroid Build Coastguard Workerconfig PIGWEED_LOG_NONE
68*61c4878aSAndroid Build Coastguard Worker    bool "Do not use pigweed logging"
69*61c4878aSAndroid Build Coastguard Worker    help
70*61c4878aSAndroid Build Coastguard Worker      Pigweed log macros will not work unless the application manually
71*61c4878aSAndroid Build Coastguard Worker      configures the logging backend.
72*61c4878aSAndroid Build Coastguard Worker
73*61c4878aSAndroid Build Coastguard Workermenuconfig PIGWEED_LOG_TOKENIZED_RPC
74*61c4878aSAndroid Build Coastguard Worker    bool "Enables RPC tokenized logging"
75*61c4878aSAndroid Build Coastguard Worker    select PIGWEED_SYNC_INTERRUPT_SPIN_LOCK
76*61c4878aSAndroid Build Coastguard Worker    select PIGWEED_SYNC_THREAD_NOTIFICATION
77*61c4878aSAndroid Build Coastguard Worker    select PIGWEED_SYNC_TIMED_THREAD_NOTIFICATION
78*61c4878aSAndroid Build Coastguard Worker    select PIGWEED_SYSTEM_HDLC_RPC_SERVER
79*61c4878aSAndroid Build Coastguard Worker    select PIGWEED_SYSTEM_LOG_BACKEND
80*61c4878aSAndroid Build Coastguard Worker    select PIGWEED_SYSTEM_TARGET_HOOKS
81*61c4878aSAndroid Build Coastguard Worker    select PIGWEED_THREAD
82*61c4878aSAndroid Build Coastguard Worker    select PIGWEED_THREAD_ITERATION
83*61c4878aSAndroid Build Coastguard Worker    select PIGWEED_TOKENIZER
84*61c4878aSAndroid Build Coastguard Worker    select LOG_CUSTOM_HEADER
85*61c4878aSAndroid Build Coastguard Worker    select SHELL_CUSTOM_HEADER
86*61c4878aSAndroid Build Coastguard Worker    depends on CONSOLE_GETCHAR
87*61c4878aSAndroid Build Coastguard Worker    help
88*61c4878aSAndroid Build Coastguard Worker      Enable tokenized logging over RPC by using the system log backend.
89*61c4878aSAndroid Build Coastguard Worker
90*61c4878aSAndroid Build Coastguard Workerendchoice
91*61c4878aSAndroid Build Coastguard Worker
92*61c4878aSAndroid Build Coastguard Workerif PIGWEED_LOG_ZEPHYR || PIGWEED_LOG_TOKENIZED || PIGWEED_LOG_TOKENIZED_RPC
93*61c4878aSAndroid Build Coastguard Worker
94*61c4878aSAndroid Build Coastguard Workerchoice "PIGWEED_LOG_LEVEL_CHOICE"
95*61c4878aSAndroid Build Coastguard Worker	prompt "Max compiled-in log level for pigweed"
96*61c4878aSAndroid Build Coastguard Worker	default PIGWEED_LOG_LEVEL_DEFAULT
97*61c4878aSAndroid Build Coastguard Worker	depends on LOG
98*61c4878aSAndroid Build Coastguard Worker
99*61c4878aSAndroid Build Coastguard Workerconfig PIGWEED_LOG_LEVEL_OFF
100*61c4878aSAndroid Build Coastguard Worker	bool "Off"
101*61c4878aSAndroid Build Coastguard Worker	help
102*61c4878aSAndroid Build Coastguard Worker	  Turn off all Pigweed logging.
103*61c4878aSAndroid Build Coastguard Worker
104*61c4878aSAndroid Build Coastguard Workerconfig PIGWEED_LOG_LEVEL_ERR
105*61c4878aSAndroid Build Coastguard Worker	bool "Error"
106*61c4878aSAndroid Build Coastguard Worker	help
107*61c4878aSAndroid Build Coastguard Worker	  Only print error level log statements.
108*61c4878aSAndroid Build Coastguard Worker
109*61c4878aSAndroid Build Coastguard Workerconfig PIGWEED_LOG_LEVEL_WRN
110*61c4878aSAndroid Build Coastguard Worker	bool "Warning"
111*61c4878aSAndroid Build Coastguard Worker	help
112*61c4878aSAndroid Build Coastguard Worker	  Only print warning level log statements and above.
113*61c4878aSAndroid Build Coastguard Worker
114*61c4878aSAndroid Build Coastguard Workerconfig PIGWEED_LOG_LEVEL_INF
115*61c4878aSAndroid Build Coastguard Worker	bool "Info"
116*61c4878aSAndroid Build Coastguard Worker	help
117*61c4878aSAndroid Build Coastguard Worker	  Only print info level log statements and above.
118*61c4878aSAndroid Build Coastguard Worker
119*61c4878aSAndroid Build Coastguard Workerconfig PIGWEED_LOG_LEVEL_DBG
120*61c4878aSAndroid Build Coastguard Worker	bool "Debug"
121*61c4878aSAndroid Build Coastguard Worker	help
122*61c4878aSAndroid Build Coastguard Worker	  Print all log statements.
123*61c4878aSAndroid Build Coastguard Worker
124*61c4878aSAndroid Build Coastguard Workerconfig PIGWEED_LOG_LEVEL_DEFAULT
125*61c4878aSAndroid Build Coastguard Worker	bool "Default"
126*61c4878aSAndroid Build Coastguard Worker	help
127*61c4878aSAndroid Build Coastguard Worker	  Use Zephyr's ``LOG_DEFAULT_LEVEL`` as the log level.
128*61c4878aSAndroid Build Coastguard Worker
129*61c4878aSAndroid Build Coastguard Workerendchoice
130*61c4878aSAndroid Build Coastguard Worker
131*61c4878aSAndroid Build Coastguard Workerconfig PIGWEED_LOG_LEVEL
132*61c4878aSAndroid Build Coastguard Worker	int
133*61c4878aSAndroid Build Coastguard Worker	depends on LOG
134*61c4878aSAndroid Build Coastguard Worker	default 0 if PIGWEED_LOG_LEVEL_OFF
135*61c4878aSAndroid Build Coastguard Worker	default 1 if PIGWEED_LOG_LEVEL_ERR
136*61c4878aSAndroid Build Coastguard Worker	default 2 if PIGWEED_LOG_LEVEL_WRN
137*61c4878aSAndroid Build Coastguard Worker	default 3 if PIGWEED_LOG_LEVEL_INF
138*61c4878aSAndroid Build Coastguard Worker	default 4 if PIGWEED_LOG_LEVEL_DBG
139*61c4878aSAndroid Build Coastguard Worker	default LOG_DEFAULT_LEVEL if PIGWEED_LOG_LEVEL_DEFAULT
140*61c4878aSAndroid Build Coastguard Worker
141*61c4878aSAndroid Build Coastguard Workerendif # PIGWEED_LOG_ZEPHYR || PIGWEED_LOG_TOKENIZED || PIGWEED_LOG_TOKENIZED_RPC
142*61c4878aSAndroid Build Coastguard Worker
143*61c4878aSAndroid Build Coastguard Workerif PIGWEED_LOG_TOKENIZED
144*61c4878aSAndroid Build Coastguard Workerrsource "Kconfig.tokenized"
145*61c4878aSAndroid Build Coastguard Workerendif # PIGWEED_LOG_TOKENIZED
146*61c4878aSAndroid Build Coastguard Worker
147*61c4878aSAndroid Build Coastguard Workerendmenu
148