public static void Append(ByteArray message, List <SdElement> sdElements, LogEventInfo logEvent)
        {
            if (LogDuplicatesPolicy.IsApplicable())
            {
                LogDuplicatesPolicy.Apply(sdElements, x => x.sdId.Render(logEvent));
            }

            foreach (var sdElement in sdElements)
            {
                var renderedSdId = sdElement.sdId.Render(logEvent);
                message.AppendBytes(LeftBracketBytes);
                sdElement.sdId.Append(message, renderedSdId);
                SdParam.Append(message, sdElement.sdParams, logEvent, SdIdToInvalidParamNamePattern.Map(renderedSdId));
                message.AppendBytes(RightBracketBytes);
            }
        }
Beispiel #2
0
        public static void Append(ByteArray message, IEnumerable <SdElement> sdElements, LogEventInfo logEvent)
        {
            var elements = sdElements
                           .Select(x => new { SdId = x.sdId, RenderedSdId = x.sdId.Render(logEvent), SdParams = x.sdParams })
                           .ToList();

            InternalLogDuplicatesPolicy.Apply(elements, x => x.RenderedSdId);

            elements
            .ForEach(elem =>
            {
                message.AppendBytes(LeftBracketBytes);
                elem.SdId.Append(message, elem.RenderedSdId);
                SdParam.Append(message, elem.SdParams, logEvent, SdIdToInvalidParamNamePattern.Map(elem.RenderedSdId));
                message.AppendBytes(RightBracketBytes);
            });
        }
 public override string ToString()
 {
     return($"[{sdId}{SdParam.ToString(sdParams)}]");
 }