diff --git a/SNMPEngine.cs b/SNMPEngine.cs index 9a6e9a6..719fe40 100644 --- a/SNMPEngine.cs +++ b/SNMPEngine.cs @@ -81,7 +81,8 @@ namespace ln.snmp IPEndPoint remoteEndpoint = new IPEndPoint(IPAddress.Any, 0); byte[] datagram = LocalEndpoint.Receive(ref remoteEndpoint); - Logging.Log(LogLevel.DEBUGDETAIL,"SNMPClient: Received: {0}", BitConverter.ToString(datagram)); + if (DEBUG) + Logging.Log(LogLevel.DEBUGDETAIL,"SNMPClient: Received: {0}", BitConverter.ToString(datagram)); ASN1Value asn = new ASN1Value(datagram); SnmpMessage snmpMessage = asn; diff --git a/types/SnmpV2Message.cs b/types/SnmpV2Message.cs index 4499d67..cac0a6e 100644 --- a/types/SnmpV2Message.cs +++ b/types/SnmpV2Message.cs @@ -22,13 +22,17 @@ namespace ln.snmp.types { } public SnmpV2Message(ASN1Value value) - :this() + : this() { snmpCommunity = (OctetString)value.Items[1]; - Logging.Log(LogLevel.DEBUG, "ASN1Value->PDU: {0}", value.Items[2]); + if (SNMPEngine.DEBUG) + Logging.Log(LogLevel.DEBUG, "ASN1Value->PDU: {0}", value.Items[2]); + snmpPDU = (PDU)value.Items[2]; - Logging.Log(LogLevel.DEBUG, "PDU: {0}", snmpPDU); + + if (SNMPEngine.DEBUG) + Logging.Log(LogLevel.DEBUG, "PDU: {0}", snmpPDU); } public override Variable[] Items