API Reference
LogRegion
The newest lines of a log: lines fill from the top and, once the region is full, the newest line stays at the bottom. It is the capture target of a live session: Console.Out, Console.Error and PowerShell streams arrive here instead of writing at a random cursor position. Only warning and error tags carry colour. Live operation: write (Text, State = level).
Inheritance
- LiveWidget
- LogRegion
Usage
Explore 24 API references to this type
This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.
Returned or exposed by 12
- Extension method LogRegion.WithCapacity
- Extension method LogRegion.WithLevelColumn
- Extension method LogRegion.WithMaxLinesPerEntry
- Extension method LogRegion.WithPreferredHeight
- Extension method LogRegion.WithShowTime
- Extension method LogRegion.WithWrap
- Method LogRegionFluent.WithCapacity
- Method LogRegionFluent.WithLevelColumn
- Method LogRegionFluent.WithMaxLinesPerEntry
- Method LogRegionFluent.WithPreferredHeight
- Method LogRegionFluent.WithShowTime
- Method LogRegionFluent.WithWrap
Accepted by parameters 12
- Extension method LogRegion.WithCapacity
- Extension method LogRegion.WithLevelColumn
- Extension method LogRegion.WithMaxLinesPerEntry
- Extension method LogRegion.WithPreferredHeight
- Extension method LogRegion.WithShowTime
- Extension method LogRegion.WithWrap
- Method LogRegionFluent.WithCapacity
- Method LogRegionFluent.WithLevelColumn
- Method LogRegionFluent.WithMaxLinesPerEntry
- Method LogRegionFluent.WithPreferredHeight
- Method LogRegionFluent.WithShowTime
- Method LogRegionFluent.WithWrap
Constructors
public LogRegion(String name = "log") #Creates a log region.
Parameters
- name System.String = "log"
- The live name (default log).
Methods
public override Void Apply(LiveEvent liveEvent) #VoidApplies an event to the widget's state.
Parameters
- liveEvent ConsoleMonster.Live.LiveEvent
- The event.
public override String? Describe(LiveEvent liveEvent) #String?Returns a line describing the event for line-based outputs (Stream/Plain), or null when the event is not worth a line (for example a single counter increment). Called after ILiveTarget.Apply.
Parameters
- liveEvent ConsoleMonster.Live.LiveEvent
- The event that was applied.
Returns
A plain line or null.
public LogHandle Handle(ILiveDispatcher dispatcher) #LogHandleReturns a handle that writes through a dispatcher.
Parameters
- dispatcher ConsoleMonster.Live.ILiveDispatcher
- The dispatcher.
Returns
The handle.
public override Size Measure(Constraints constraints, RenderContext context) #SizeReturns the size the widget wants within the constraints.
Parameters
- constraints ConsoleMonster.Layout.Constraints
- The space offered.
- context ConsoleMonster.Canvas.RenderContext
- Profile, theme and glyphs.
Returns
The desired size, never larger than the constraints.
public override Void Render(Region region, RenderContext context) #VoidRenders into a region. The region may be smaller or larger than the measured size.
Parameters
- region ConsoleMonster.Canvas.Region
- The target region.
- context ConsoleMonster.Canvas.RenderContext
- Profile, theme and glyphs.
public Void Write(String text, String level = "info", TimeSpan time = default) #VoidAppends text; line breaks create several entries.
Parameters
- text System.String
- The text.
- level System.String = "info"
- The level.
- time System.TimeSpan = default
- Session time.
public Void Write(RichText text, String level = "info", TimeSpan time = default) #VoidAppends a multicolour line (line breaks inside it create several entries, each keeping its styles).
Parameters
- text ConsoleMonster.Text.RichText
- The rich text.
- level System.String = "info"
- The level.
- time System.TimeSpan = default
- Session time.
Inherited Methods
public virtual Boolean Equals(Object? obj) #BooleanParameters
- obj Object?
Properties
public Int32 PreferredHeight { get; set; } #Rows requested when measured without a height limit (default 8).
public Boolean ShowTime { get; set; } #Whether entries show their session time (default true).
public Boolean Wrap { get; set; } #Whether long entries continue on further rows, aligned under the message, instead of being truncated (default false). Lines break after spaces, then after separators, as everywhere else.
public Int32 MaxLinesPerEntry { get; set; } #The most rows one entry may use when LogRegion.Wrap is on; the last row ends with an ellipsis when cut (default 3).
public IReadOnlyCollection<LogEntry> Entries { get; } #The kept entries, oldest first.
public Int64 TotalLines { get; private set; } #Total lines received (including dropped ones).
public ColumnFormat LevelColumn { get; set; } #Layout of the level column (ERR, WARN, VERB...). Every row shares its width, including info lines that have no tag, so messages always start in the same column; the width never shrinks during a session.
Inherited Properties
Extension Methods
public static LogRegion WithCapacity(LogRegion logRegion, Int32 value) #LogRegionSets LogRegion.Capacity: How many lines are kept (default 1000).
Parameters
- logRegion ConsoleMonster.Widgets.LogRegion
- The instance.
- value System.Int32
- The value.
Returns
The same instance.
public static LogRegion WithLevelColumn(LogRegion logRegion, ColumnFormat value) #LogRegionSets LogRegion.LevelColumn: Layout of the level column (ERR, WARN, VERB...). Every row shares its width, including info lines that have no tag, so messages always start in the same column; the width never shrinks during a session.
Parameters
- logRegion ConsoleMonster.Widgets.LogRegion
- The instance.
- value ConsoleMonster.Layout.ColumnFormat
- The value.
Returns
The same instance.
public static LogRegion WithLevelColumn(LogRegion logRegion, Action<ColumnFormat> configure) #LogRegionConfigures LogRegion.LevelColumn in place: Layout of the level column (ERR, WARN, VERB...). Every row shares its width, including info lines that have no tag, so messages always start in the same column; the width never shrinks during a session.
Parameters
- logRegion ConsoleMonster.Widgets.LogRegion
- The instance.
- configure System.Action<ConsoleMonster.Layout.ColumnFormat>
- Configures the value.
Returns
The same instance.
public static LogRegion WithMaxLinesPerEntry(LogRegion logRegion, Int32 value) #LogRegionSets LogRegion.MaxLinesPerEntry: The most rows one entry may use when LogRegion.Wrap is on; the last row ends with an ellipsis when cut (default 3).
Parameters
- logRegion ConsoleMonster.Widgets.LogRegion
- The instance.
- value System.Int32
- The value.
Returns
The same instance.
public static LogRegion WithPreferredHeight(LogRegion logRegion, Int32 value) #LogRegionSets LogRegion.PreferredHeight: Rows requested when measured without a height limit (default 8).
Parameters
- logRegion ConsoleMonster.Widgets.LogRegion
- The instance.
- value System.Int32
- The value.
Returns
The same instance.
public static LogRegion WithShowTime(LogRegion logRegion, Boolean value = true) #LogRegionSets LogRegion.ShowTime: Whether entries show their session time (default true).
Parameters
- logRegion ConsoleMonster.Widgets.LogRegion
- The instance.
- value System.Boolean = true
- The value (default true).
Returns
The same instance.
public static LogRegion WithWrap(LogRegion logRegion, Boolean value = true) #LogRegionSets LogRegion.Wrap: Whether long entries continue on further rows, aligned under the message, instead of being truncated (default false). Lines break after spaces, then after separators, as everywhere else.
Parameters
- logRegion ConsoleMonster.Widgets.LogRegion
- The instance.
- value System.Boolean = true
- The value (default true).
Returns
The same instance.