Show / Hide Table of Contents

Class LoggedRenderer<T>

Decorates an IRenderer<T> so that all event messages are logged.

Every single event message causes two log messages: one is logged before rendering, and other one is logged after rendering. If any exception is thrown it is also logged with the log level (regardless of Level configuration).

Inheritance
Object
LoggedRenderer<T>
LoggedActionRenderer<T>
Implements
IRenderer<T>
Namespace: Libplanet.Blockchain.Renderers
Assembly: Libplanet.dll
Syntax
public class LoggedRenderer<T> : object, IRenderer<T> where T : IAction, new()
Type Parameters
Name Description
T

An IAction type. It should match to BlockChain<T>'s type parameter.

Remarks

Since IActionRenderer<T> is a subtype of IRenderer<T>, LoggedRenderer(IRenderer<T>, ILogger, LogEventLevel) constructor can take an IActionRenderer<T> instance as well. However, even it takes an action renderer, action-level fine-grained events will not be logged. For action renderers, please use LoggedActionRenderer<T> instead.

Examples
IRenderer<ExampleAction> renderer = new SomeRenderer();
// Wraps the renderer with LoggedRenderer:
renderer = new LoggedRenderer<ExampleAction>(
    renderer,
    Log.Logger,
    LogEventLevel.Information,
);

Constructors

| Improve this Doc View Source

LoggedRenderer(IRenderer<T>, ILogger, LogEventLevel)

Creates a new LoggedRenderer<T> instance which decorates the given renderer.

Declaration
public LoggedRenderer(IRenderer<T> renderer, ILogger logger, LogEventLevel level = null)
Parameters
Type Name Description
IRenderer<T> renderer

The actual renderer to forward all event messages to and actually render things.

ILogger logger

The logger to write log messages to. Note that all log messages this decorator writes become in the context of the renderer's type (with the context property SourceContext).

LogEventLevel level

The log event level. All log messages become this level.

Properties

| Improve this Doc View Source

Level

The log event level. All log messages become this level.

Declaration
public LogEventLevel Level { get; }
Property Value
Type Description
LogEventLevel
| Improve this Doc View Source

Logger

The logger to write log messages to. Note that all log messages this decorator writes become in the context of the Renderer's type (with the context property SourceContext).

Declaration
protected ILogger Logger { get; }
Property Value
Type Description
ILogger
| Improve this Doc View Source

Renderer

The inner renderer to forward all event messages to and actually render things.

Declaration
public IRenderer<T> Renderer { get; }
Property Value
Type Description
IRenderer<T>

Methods

| Improve this Doc View Source

LogBlockRendering(String, Block<T>, Block<T>, System.Action<Block<T>, Block<T>>)

Declaration
protected void LogBlockRendering(string methodName, Block<T> oldTip, Block<T> newTip, System.Action<Block<T>, Block<T>> callback)
Parameters
Type Name Description
String methodName
Block<T> oldTip
Block<T> newTip
System.Action<Block<T>, Block<T>> callback
| Improve this Doc View Source

RenderBlock(Block<T>, Block<T>)

Declaration
public void RenderBlock(Block<T> oldTip, Block<T> newTip)
Parameters
Type Name Description
Block<T> oldTip
Block<T> newTip
| Improve this Doc View Source

RenderReorg(Block<T>, Block<T>, Block<T>)

Declaration
public void RenderReorg(Block<T> oldTip, Block<T> newTip, Block<T> branchpoint)
Parameters
Type Name Description
Block<T> oldTip
Block<T> newTip
Block<T> branchpoint
| Improve this Doc View Source

RenderReorgEnd(Block<T>, Block<T>, Block<T>)

Declaration
public void RenderReorgEnd(Block<T> oldTip, Block<T> newTip, Block<T> branchpoint)
Parameters
Type Name Description
Block<T> oldTip
Block<T> newTip
Block<T> branchpoint

Implements

IRenderer<T>
  • Improve this Doc
  • View Source
Back to top Copyright © 2019–2020 Planetarium