Class LoggingComponentRenderer

Version: 21.x

An IComponentRenderer that writes to a specified log instead of generating HTML output.

Inheritance

System.Object

LoggingComponentRenderer

Implements

IComponentRenderer

Namespace: Sitecore.AspNet.RenderingEngine.Rendering

Assembly: Sitecore.AspNet.RenderingEngine.dll
Syntax
public class LoggingComponentRenderer : Object, IComponentRenderer

Constructors

LoggingComponentRenderer(ILogger)

Initializes a new instance of the LoggingComponentRenderer class.

Declaration
public LoggingComponentRenderer(ILogger<LoggingComponentRenderer> logger)
Parameters
TypeNameDescription
Microsoft.Extensions.Logging.ILogger

<

LoggingComponentRenderer

>
loggerThe Microsoft.Extensions.Logging.ILogger to use for logging.

Methods

Describe(Predicate)

Creates an instance of a ComponentRendererDescriptor for the LoggingComponentRenderer class.

Declaration
public static ComponentRendererDescriptor Describe(Predicate<string> match)
Parameters
TypeNameDescription
System.Predicate

<

System.String

>
matchA predicate to use when attempting to match a layout component.
Returns
TypeDescription
ComponentRendererDescriptorAn instance of ComponentRendererDescriptor that describes the LoggingComponentRenderer.

Render(ISitecoreRenderingContext, ViewContext)

Generates the output HTML.

Declaration
public Task<IHtmlContent> Render(ISitecoreRenderingContext renderingContext, ViewContext viewContext)
Parameters
TypeNameDescription
ISitecoreRenderingContextrenderingContextThe current ISitecoreRenderingContext.
Microsoft.AspNetCore.Mvc.Rendering.ViewContextviewContextThe current Microsoft.AspNetCore.Mvc.Rendering.ViewContext.
Returns
TypeDescription
System.Threading.Tasks.Task

<

Microsoft.AspNetCore.Html.IHtmlContent

>
The HTML content to render.

Implements

IComponentRenderer

If you have suggestions for improving this article, let us know!