Improve logging in dictionary

This commit is contained in:
Istvan Ruzman
2020-08-12 08:31:58 +02:00
parent 5c110669b2
commit 6d8dd18601

View File

@@ -194,8 +194,10 @@ class Dictionary:
for line_num, tokens in reader:
key = tokens[0]
if key == "ATTRIBUTE":
# logging is done within the method
self._parse_attribute(tokens, line_num)
elif key == "VALUE":
# logging is done within the method
self._parse_value(tokens, line_num)
elif key == "FILE_OPENED":
LOG.info("Parsing file: %s", tokens[1])
@@ -209,10 +211,13 @@ class Dictionary:
LOG.info("Finished parsing file: %s", filename)
elif key == "VENDOR":
self._parse_vendor(tokens, line_num)
LOG.info("Register vendor %s", tokens[1])
elif key == "BEGIN-VENDOR":
self._parse_begin_vendor(tokens, line_num)
LOG.info("Open Vendor section %s", tokens[1])
elif key == "END-VENDOR":
self._parse_end_vendor(tokens, line_num)
LOG.info("Close Vendor section %s", tokens[1])
elif key == "BEGIN-TLV":
raise NotImplementedError(
"BEGIN-TLV is deprecated and not supported by pyrad3"
@@ -455,6 +460,13 @@ class Dictionary:
if self.cur_vendor != self.rfc_vendor:
codes = [26, self.cur_vendor.code] + codes
LOG.info(
"Register Attribute %s for Vendor %s",
attribute.name,
self.cur_vendor.name,
)
else:
LOG.info("Register Attribute %s", attribute.name)
attrcode = codes[0] if len(codes) == 1 else tuple(codes)
self.attrindex[attrcode] = attribute
self.attrindex[name] = attribute