@@ -158,6 +158,14 @@ def BuildRoot(self, root, board, os_env):
158
158
return os .path .join (root , 'examples' , self .ExampleName (), 'nxp' , board .FolderName (os_env ))
159
159
160
160
161
+ class NxpLogLevel (Enum ):
162
+ DEFAULT = auto () # default everything
163
+ ALL = auto () # enable all logging
164
+ PROGRESS = auto () # progress and above
165
+ ERROR = auto () # error and above
166
+ NONE = auto () # no chip_logging at all
167
+
168
+
161
169
class NxpBuilder (GnBuilder ):
162
170
163
171
def __init__ (self ,
@@ -187,7 +195,9 @@ def __init__(self,
187
195
disable_pairing_autostart : bool = False ,
188
196
iw416_transceiver : bool = False ,
189
197
w8801_transceiver : bool = False ,
190
- iwx12_transceiver : bool = False ):
198
+ iwx12_transceiver : bool = False ,
199
+ log_level : NxpLogLevel = NxpLogLevel .DEFAULT ,
200
+ ):
191
201
super (NxpBuilder , self ).__init__ (
192
202
root = app .BuildRoot (root , board , os_env ),
193
203
runner = runner )
@@ -217,12 +227,16 @@ def __init__(self,
217
227
self .iw416_transceiver = iw416_transceiver
218
228
self .w8801_transceiver = w8801_transceiver
219
229
self .iwx12_transceiver = iwx12_transceiver
230
+ if self .low_power and log_level != NxpLogLevel .NONE :
231
+ logging .warning ("Switching log level to 'NONE' for low power build" )
232
+ log_level = NxpLogLevel .NONE
233
+ self .log_level = log_level
220
234
221
235
def GnBuildArgs (self ):
222
236
args = []
223
237
224
238
if self .low_power :
225
- args .append ('chip_with_low_power=1 chip_logging=false ' )
239
+ args .append ('chip_with_low_power=1' )
226
240
if self .board == NxpBoard .K32W0 :
227
241
args .append ('chip_pw_tokenizer_logging=false chip_with_OM15082=0' )
228
242
@@ -244,6 +258,31 @@ def GnBuildArgs(self):
244
258
if self .enable_rotating_id :
245
259
args .append ('chip_enable_rotating_device_id=1 chip_enable_additional_data_advertising=1' )
246
260
261
+ if self .log_level == NxpLogLevel .DEFAULT :
262
+ pass
263
+ elif self .log_level == NxpLogLevel .ALL :
264
+ args .append ("chip_logging=true" )
265
+ args .append ("chip_error_logging=true" )
266
+ args .append ("chip_progress_logging=true" )
267
+ args .append ("chip_detail_logging=true" )
268
+ args .append ("chip_automation_logging=true" )
269
+ elif self .log_level == NxpLogLevel .PROGRESS :
270
+ args .append ("chip_logging=true" )
271
+ args .append ("chip_error_logging=true" )
272
+ args .append ("chip_progress_logging=true" )
273
+ args .append ("chip_detail_logging=false" )
274
+ args .append ("chip_automation_logging=false" )
275
+ elif self .log_level == NxpLogLevel .ERROR :
276
+ args .append ("chip_logging=true" )
277
+ args .append ("chip_error_logging=true" )
278
+ args .append ("chip_progress_logging=false" )
279
+ args .append ("chip_detail_logging=false" )
280
+ args .append ("chip_automation_logging=false" )
281
+ elif self .log_level == NxpLogLevel .NONE :
282
+ args .append ("chip_logging=false" )
283
+ else :
284
+ raise Exception ("Unknown log level: %r" , self .log_level )
285
+
247
286
if self .has_sw_version_2 :
248
287
args .append ('nxp_software_version=2' )
249
288
0 commit comments