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,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;

View File

@ -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