src/NLog/Layouts/Layout.cs
/// <summary>
/// Valid default implementation of <see cref="GetFormattedMessage" />, when having implemented the optimized <see cref="RenderFormattedMessage"/>
/// </summary>
/// <param name="logEvent">The logging event.</param>
/// <param name="reusableBuilder">StringBuilder to help minimize allocations [optional].</param>
/// <returns>The rendered layout.</returns>
Valid default implementation of , when having implemented the optimized
Valid default implementation of when having implemented the optimized
internal string RenderAllocateBuilder(LogEventInfo logEvent, StringBuilder reusableBuilder = null)
        {
            int initialLength = _maxRenderedLength;
            if (initialLength > MaxInitialRenderBufferLength)
            {
                initialLength = MaxInitialRenderBufferLength;
            }
            var sb = reusableBuilder ?? new StringBuilder(initialLength);
            RenderFormattedMessage(logEvent, sb);
            if (sb.Length > _maxRenderedLength)
            {
                _maxRenderedLength = sb.Length;
            }
            return sb.ToString();
        }
internal string RenderAllocateBuilder ( LogEventInfo logEvent , StringBuilder reusableBuilder = null ) { int initialLength = _maxRenderedLength ; if ( initialLength > MaxInitialRenderBufferLength ) { initialLength = MaxInitialRenderBufferLength ; } var sb = reusableBuilder ?? new StringBuilder ( initialLength ) ; RenderFormattedMessage ( logEvent , sb ) ; if ( sb . Length > _maxRenderedLength ) { _maxRenderedLength = sb . Length ; } return sb . ToString ( ) ; }
Valid default implementation of , when having implemented the optimized
Valid default implementation of when having implemented the optimized
The rendered layout.
The rendered layout .
logEvent
LogEventInfo
The logging event.
The logging event .
reusableBuilder
StringBuilder
StringBuilder to help minimize allocations [optional].
StringBuilder to help minimize allocations [ optional ] .