21
21
from .context import Context , IdlPostProcessor
22
22
from .parsing import AttrsToAccessPrivilege , AttrsToAttribute , ParseInt
23
23
24
+ LOGGER = logging .getLogger ('matter-xml-parser' )
25
+
24
26
25
27
class ClusterNameHandler (BaseHandler ):
26
28
"""Handles /configurator/cluster/name elements."""
@@ -137,7 +139,7 @@ def GetNextProcessor(self, name: str, attrs):
137
139
elif attrs ['op' ] == 'write' :
138
140
self ._attribute .writeacl = role
139
141
else :
140
- logging .error ("Unknown access: %r" % attrs ['op' ])
142
+ LOGGER .error ("Unknown access: %r" % attrs ['op' ])
141
143
142
144
return BaseHandler (self .context , handled = HandledDepth .SINGLE_TAG )
143
145
elif name .lower () == 'description' :
@@ -230,8 +232,8 @@ def FinalizeProcessing(self, idl: Idl):
230
232
found = True
231
233
232
234
if not found :
233
- logging .error ('Enum %s could not find cluster (code %d/0x%X)' %
234
- (self ._struct .name , code , code ))
235
+ LOGGER .error ('Enum %s could not find cluster (code %d/0x%X)' %
236
+ (self ._struct .name , code , code ))
235
237
else :
236
238
idl .structs .append (self ._struct )
237
239
@@ -279,8 +281,8 @@ def FinalizeProcessing(self, idl: Idl):
279
281
found = True
280
282
281
283
if not found :
282
- logging .error ('Enum %s could not find its cluster (code %d/0x%X)' %
283
- (self ._enum .name , self ._cluster_code , self ._cluster_code ))
284
+ LOGGER .error ('Enum %s could not find its cluster (code %d/0x%X)' %
285
+ (self ._enum .name , self ._cluster_code , self ._cluster_code ))
284
286
285
287
def EndProcessing (self ):
286
288
self .context .AddIdlPostProcessor (self )
@@ -319,7 +321,7 @@ def FinalizeProcessing(self, idl: Idl):
319
321
# Log only instead of critical, as not our XML is well formed.
320
322
# For example at the time of writing this, SwitchFeature in switch-cluster.xml
321
323
# did not have a code associated with it.
322
- logging .error ("Bitmap %r has no cluster codes" % self ._bitmap )
324
+ LOGGER .error ("Bitmap %r has no cluster codes" % self ._bitmap )
323
325
return
324
326
325
327
for code in self ._cluster_codes :
@@ -329,8 +331,8 @@ def FinalizeProcessing(self, idl: Idl):
329
331
c .bitmaps .append (self ._bitmap )
330
332
found = True
331
333
if not found :
332
- logging .error ('Bitmap %s could not find its cluster (code %d/0x%X)' %
333
- (self ._bitmap .name , code , code ))
334
+ LOGGER .error ('Bitmap %s could not find its cluster (code %d/0x%X)' %
335
+ (self ._bitmap .name , code , code ))
334
336
335
337
def EndProcessing (self ):
336
338
self .context .AddIdlPostProcessor (self )
@@ -413,7 +415,7 @@ def GetNextProcessor(self, name: str, attrs):
413
415
if self ._command :
414
416
self ._command .invokeacl = AttrsToAccessPrivilege (attrs )
415
417
else :
416
- logging .warning (
418
+ LOGGER .warning (
417
419
"Ignored access role for reply %r" % self ._struct )
418
420
return BaseHandler (self .context , handled = HandledDepth .SINGLE_TAG )
419
421
elif name .lower () == 'arg' :
@@ -448,7 +450,7 @@ def GetNextProcessor(self, name: str, attrs):
448
450
if name .lower () == 'featurebit' :
449
451
# It is uncler what featurebits mean. likely a bitmap should be created
450
452
# here, however only one such example exists currently: door-lock-cluster.xml
451
- logging .info ('Ignoring featurebit tag for global attribute 0x%X (%d)' % (
453
+ LOGGER .info ('Ignoring featurebit tag for global attribute 0x%X (%d)' % (
452
454
self ._code , self ._code ))
453
455
return BaseHandler (self .context , handled = HandledDepth .SINGLE_TAG )
454
456
else :
@@ -533,8 +535,8 @@ def FinalizeProcessing(self, idl: Idl):
533
535
c .commands .extend (self ._cluster .commands )
534
536
535
537
if not found :
536
- logging .error ('Could not extend cluster 0x%X (%d): cluster not found' %
537
- (self ._cluster_code , self ._cluster_code ))
538
+ LOGGER .error ('Could not extend cluster 0x%X (%d): cluster not found' %
539
+ (self ._cluster_code , self ._cluster_code ))
538
540
539
541
540
542
class GlobalAttributeHandler (BaseHandler ):
@@ -572,7 +574,7 @@ def GetNextProcessor(self, name, attrs):
572
574
if attrs ['side' ].lower () == 'client' :
573
575
# We expect to also have 'server' equivalent, so ignore client
574
576
# side attributes
575
- logging .debug (
577
+ LOGGER .debug (
576
578
'Ignoring global client-side attribute %s' % (attrs ['code' ]))
577
579
return BaseHandler (self .context , handled = HandledDepth .SINGLE_TAG )
578
580
0 commit comments