User DEBUG static flag to reduce logging overhead

master
Harald Wolff 2019-08-20 12:56:41 +02:00
parent 5f4bacee39
commit 81f88b2473
2 changed files with 9 additions and 4 deletions

View File

@ -81,6 +81,7 @@ namespace ln.snmp
IPEndPoint remoteEndpoint = new IPEndPoint(IPAddress.Any, 0);
byte[] datagram = LocalEndpoint.Receive(ref remoteEndpoint);
if (DEBUG)
Logging.Log(LogLevel.DEBUGDETAIL,"SNMPClient: Received: {0}", BitConverter.ToString(datagram));
ASN1Value asn = new ASN1Value(datagram);

View File

@ -22,12 +22,16 @@ namespace ln.snmp.types
{
}
public SnmpV2Message(ASN1Value value)
:this()
: this()
{
snmpCommunity = (OctetString)value.Items[1];
if (SNMPEngine.DEBUG)
Logging.Log(LogLevel.DEBUG, "ASN1Value->PDU: {0}", value.Items[2]);
snmpPDU = (PDU)value.Items[2];
if (SNMPEngine.DEBUG)
Logging.Log(LogLevel.DEBUG, "PDU: {0}", snmpPDU);
}