improvement: add flag for agentx debugging

agentx/network.py always turned on debugging. It can be useful to have
debugging logs of the main application without the agentx debug logs, as
they are quite noisy.

Now, ./vpp-snmp-agent.py -d will turn on application debugging but NOT
agentx debugging. ./vpp-snmp-agent.py -d -dd will turn on both.

NOTE: ./vpp-snmp-agent.py -dd will do nothing, because the '-d' flag
determines the global logging level.
This commit is contained in:
Pim van Pelt
2023-01-10 15:21:32 +01:00
parent 0d7dea37f5
commit 31529a2815
3 changed files with 14 additions and 4 deletions

View File

@ -27,11 +27,11 @@ class NetworkError(Exception):
class Network:
def __init__(self, server_address="/var/agentx/master"):
def __init__(self, server_address="/var/agentx/master", debug=False):
self.session_id = 0
self.transaction_id = 0
self.debug = 1
self.debug = debug
# Data Related Variables
self.data = {}
self.data_idx = []