Class LoggingComponentRenderer
An IComponentRenderer that writes to a specified log instead of generating HTML output.
Inheritance
System.Object
LoggingComponentRenderer
Implements
Namespace: Sitecore.AspNet.RenderingEngine.Rendering
Assembly: Sitecore.AspNet.RenderingEngine.dll
Syntax
public class LoggingComponentRenderer : Object, IComponentRenderer
Constructors
LoggingComponentRenderer(ILogger<LoggingComponentRenderer>)
Initializes a new instance of the LoggingComponentRenderer class.
Declaration
public LoggingComponentRenderer(ILogger<LoggingComponentRenderer> logger)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Extensions.Logging.ILogger<LoggingComponentRenderer> | logger | The Microsoft.Extensions.Logging.ILogger to use for logging. |
Methods
Describe(Predicate<String>)
Creates an instance of a ComponentRendererDescriptor for the LoggingComponentRenderer class.
Declaration
public static ComponentRendererDescriptor Describe(Predicate<string> match)
Parameters
Type | Name | Description |
---|---|---|
System.Predicate<System.String> | match | A predicate to use when attempting to match a layout component. |
Returns
Type | Description |
---|---|
ComponentRendererDescriptor | An instance of ComponentRendererDescriptor that describes the LoggingComponentRenderer. |
Render(ISitecoreRenderingContext, ViewContext)
Generates the output HTML.
Declaration
public Task<IHtmlContent> Render(ISitecoreRenderingContext renderingContext, ViewContext viewContext)
Parameters
Type | Name | Description |
---|---|---|
ISitecoreRenderingContext | renderingContext | The current ISitecoreRenderingContext. |
Microsoft.AspNetCore.Mvc.Rendering.ViewContext | viewContext | The current Microsoft.AspNetCore.Mvc.Rendering.ViewContext. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Microsoft.AspNetCore.Html.IHtmlContent> | The HTML content to render. |