public void Log(SnmpContext context) { if (Logger.IsInfoEnabled) { Logger.Info(GetLogEntry(context)); } }
private static string GetLogEntry(SnmpContext context) { return(string.Format( CultureInfo.InvariantCulture, "{0} {1} {2} {3} {4} {5} {6} {7} {8} {9}", DateTime.UtcNow, context.Binding.Endpoint.Address, context.Request.Pdu.TypeCode == SnmpType.Unknown ? Empty : context.Request.Pdu.TypeCode.ToString(), GetStem(context.Request.Pdu.Variables), context.Binding.Endpoint.Port, context.Request.Parameters.UserName, context.Sender.Address, (context.Response == null) ? Empty : context.Response.Pdu.ErrorStatus.ToErrorCode().ToString(), context.Request.Version, DateTime.Now.Subtract(context.CreatedTime).TotalMilliseconds)); }
/// <summary> /// Inits the specified context. /// </summary> /// <param name="context">The context.</param> public void Init(SnmpContext context) { Context = context; ProcessingFinished = false; _handler = null; }
/// <summary> /// Inits the specified context. /// </summary> /// <param name="context">The context.</param> public void Init(SnmpContext context) { Context = context; ProcessingFinished = false; _handler = null; }