From 6d8dd18601b7c693d72162bc171f220350e4587a Mon Sep 17 00:00:00 2001 From: Istvan Ruzman Date: Wed, 12 Aug 2020 08:31:58 +0200 Subject: [PATCH] Improve logging in dictionary --- src/pyrad3/dictionary.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/pyrad3/dictionary.py b/src/pyrad3/dictionary.py index 115cb15..0614aef 100644 --- a/src/pyrad3/dictionary.py +++ b/src/pyrad3/dictionary.py @@ -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