LogRegion
ConsoleMonster.Widgets
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; source tags get a stable series colour each. Live operation: write (Text, State = level, Key = source tag).
Inheritance
- LiveWidget
- LogRegion
Usage
Explore 58 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 28
- Method Ui.LogRegion
- Extension method LogRegion.Capacity
- Extension method LogRegion.Filter
- Extension method LogRegion.FitToEntries
- Extension method LogRegion.HighlightText
- Extension method LogRegion.LevelColumn
- Extension method LogRegion.MaxLinesPerEntry
- Extension method LogRegion.PreferredHeight
- Extension method LogRegion.Scrollback
- Extension method LogRegion.ScrollOffset
- Extension method LogRegion.ShowElapsed
- Extension method LogRegion.ShowTimestamp
- Extension method LogRegion.TimestampFormat
- Extension method LogRegion.Wrap
- Method LogRegionFluent.Capacity
- Method LogRegionFluent.Filter
- Method LogRegionFluent.FitToEntries
- Method LogRegionFluent.HighlightText
- Method LogRegionFluent.LevelColumn
- Method LogRegionFluent.MaxLinesPerEntry
- Method LogRegionFluent.PreferredHeight
- Method LogRegionFluent.Scrollback
- Method LogRegionFluent.ScrollOffset
- Method LogRegionFluent.ShowElapsed
- Method LogRegionFluent.ShowTimestamp
- Method LogRegionFluent.TimestampFormat
- Method LogRegionFluent.Wrap
- Property RunDashboard.Log
Accepted by parameters 30
- Method ContentBuilder.LogRegion
- Method ContentBuilder.LogRegion
- Extension method LogRegion.Capacity
- Extension method LogRegion.Filter
- Extension method LogRegion.FitToEntries
- Extension method LogRegion.HighlightText
- Extension method LogRegion.LevelColumn
- Extension method LogRegion.MaxLinesPerEntry
- Extension method LogRegion.PreferredHeight
- Extension method LogRegion.Scrollback
- Extension method LogRegion.ScrollOffset
- Extension method LogRegion.ShowElapsed
- Extension method LogRegion.ShowTimestamp
- Extension method LogRegion.TimestampFormat
- Extension method LogRegion.Wrap
- Method LogRegionFluent.Capacity
- Method LogRegionFluent.Filter
- Method LogRegionFluent.FitToEntries
- Method LogRegionFluent.HighlightText
- Method LogRegionFluent.LevelColumn
- Method LogRegionFluent.MaxLinesPerEntry
- Method LogRegionFluent.PreferredHeight
- Method LogRegionFluent.Scrollback
- Method LogRegionFluent.ScrollOffset
- Method LogRegionFluent.ShowElapsed
- Method LogRegionFluent.ShowTimestamp
- Method LogRegionFluent.TimestampFormat
- Method LogRegionFluent.Wrap
- Extension method RunDashboard.Log
- Method RunDashboardFluent.Log
Constructors
public LogRegion(string widgetId = "log") #Creates a log region.
Parameters
- widgetId string = "log"
- The live name (default log).
Methods
public override void Apply(LiveEvent liveEvent) #Applies an event to the widget's state.
Parameters
- liveEvent ConsoleMonster.Live.LiveEvent
- The event.
public override string? Describe(LiveEvent liveEvent) #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
string? A plain line or null.public LogHandle Handle(ILiveDispatcher dispatcher) #Returns a handle that writes through a dispatcher.
Parameters
- dispatcher ConsoleMonster.Live.ILiveDispatcher
- The dispatcher.
public override Size Measure(Constraints constraints, RenderContext context) #Returns the size the widget wants within the constraints.
Parameters
- constraints ConsoleMonster.Layout.Constraints
- The space offered.
- context ConsoleMonster.Canvas.RenderContext
- Profile, theme and glyphs.
public override void Render(Region region, RenderContext context) #Renders 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) #Appends text; line breaks create several entries.
Parameters
- text string
- The text.
- level string = "info"
- The level.
- time System.TimeSpan = default
- Session time.
public void Write(LogEntry entry) #Appends an entry, preserving its selected rich line, level, session time and source timestamp. Caller-created multiline entries expand into lines.
Parameters
- entry ConsoleMonster.Widgets.LogEntry
- An existing log entry or a new message entry.
Exceptions
ArgumentNullExceptionโ The entry is null.
public void Write(RichText text, string level = "info", TimeSpan time = default) #Appends rich text as separate lines, preserving styles across line breaks. Malformed markup is literal.
Parameters
- text ConsoleMonster.Text.RichText
- The rich text.
- level string = "info"
- The level.
- time System.TimeSpan = default
- Session time.
public void WriteTimestamped(string text, string level, DateTimeOffset? timestamp) #Appends literal text with an optional source timestamp; no session time is invented.
Parameters
- text string
- The original text; line breaks create several entries.
- level string
- The level.
- timestamp System.DateTimeOffset?
- The source timestamp, or null when unknown.
Inherited Methods
Properties
public bool Scrollback { get; set; } #Also append each entry to normal scrollback above an inline live area. The retained entries still obey LogRegion.Capacity.
public int PreferredHeight { get; set; } #Rows requested when measured without a height limit (default 8).
public bool FitToEntries { get; set; } #Takes only the rows its newest entries need, up to LogRegion.PreferredHeight, under a height limit too, and no rows while it is empty, so a message area in an inline live view appears and grows as messages arrive. Off by default: a dashboard keeps a stable LogRegion.PreferredHeight (and an empty log panel keeps a blank row).
public bool ShowElapsed { get; set; } #Whether entries show their session time (default true).
public int ScrollOffset { get; set; } #Entries skipped from the newest end while scrolling; zero follows the newest entries.
public bool ShowTimestamp { get; set; } #Shows source timestamps instead of session time; missing timestamps reserve a blank aligned cell.
public string TimestampFormat { get; set; } #Source timestamp format, using invariant culture (default ISO date, time, milliseconds and offset).
public string? HighlightText { get; set; } #Literal ordinal case-insensitive substring to emphasize in plain-text entries; null or empty disables it.
public bool 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 int 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 LogFilter? Filter { get; set; } #Which kept entries are drawn, or null for all of them. Hidden entries stay kept and count toward LogRegion.Capacity.
public long 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
Fields
public const int MaxLineLength #The most characters a literal entry keeps (16,384). A longer line ends with an ellipsis: no row can show it, and LogRegion.Capacity bounds the number of entries, not their size.
16384Extension Methods
public static LogRegion Capacity(LogRegion logRegion, int value) #Sets LogRegion.Capacity: How many lines are kept (default 1000).
Parameters
- logRegion ConsoleMonster.Widgets.LogRegion
- The instance.
- value int
- The value.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.LogRegion { Capacity = value }; Ui.LogRegion().Capacity(value);public static LogRegion Filter(LogRegion logRegion, LogFilter? value) #Sets LogRegion.Filter: Which kept entries are drawn, or null for all of them. Hidden entries stay kept and count toward LogRegion.Capacity.
Parameters
- logRegion ConsoleMonster.Widgets.LogRegion
- The instance.
- value ConsoleMonster.Widgets.LogFilter?
- The value.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.LogRegion { Filter = value }; Ui.LogRegion().Filter(value);public static LogRegion FitToEntries(LogRegion logRegion, bool value = true) #Sets LogRegion.FitToEntries: Takes only the rows its newest entries need, up to LogRegion.PreferredHeight, under a height limit too, and no rows while it is empty, so a message area in an inline live view appears and grows as messages arrive. Off by default: a dashboard keeps a stable LogRegion.PreferredHeight (and an empty log panel keeps a blank row).
Parameters
- logRegion ConsoleMonster.Widgets.LogRegion
- The instance.
- value bool = true
- The value; true when omitted.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.LogRegion { FitToEntries = value }; Ui.LogRegion().FitToEntries(value);public static LogRegion HighlightText(LogRegion logRegion, string? value) #Sets LogRegion.HighlightText: Literal ordinal case-insensitive substring to emphasize in plain-text entries; null or empty disables it.
Parameters
- logRegion ConsoleMonster.Widgets.LogRegion
- The instance.
- value string?
- The value.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.LogRegion { HighlightText = value }; Ui.LogRegion().HighlightText(value);public static LogRegion LevelColumn(LogRegion logRegion, ColumnFormat value) #Sets 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.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.LogRegion { LevelColumn = value }; Ui.LogRegion().LevelColumn(value);public static LogRegion LevelColumn(LogRegion logRegion, Action<ColumnFormat> configure) #Configures 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.
public static LogRegion MaxLinesPerEntry(LogRegion logRegion, int value) #Sets 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 int
- The value.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.LogRegion { MaxLinesPerEntry = value }; Ui.LogRegion().MaxLinesPerEntry(value);public static LogRegion PreferredHeight(LogRegion logRegion, int value) #Sets LogRegion.PreferredHeight: Rows requested when measured without a height limit (default 8).
Parameters
- logRegion ConsoleMonster.Widgets.LogRegion
- The instance.
- value int
- The value.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.LogRegion { PreferredHeight = value }; Ui.LogRegion().PreferredHeight(value);public static LogRegion Scrollback(LogRegion logRegion, bool value = true) #Sets LogRegion.Scrollback: Also append each entry to normal scrollback above an inline live area. The retained entries still obey LogRegion.Capacity.
Parameters
- logRegion ConsoleMonster.Widgets.LogRegion
- The instance.
- value bool = true
- The value; true when omitted.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.LogRegion { Scrollback = value }; Ui.LogRegion().Scrollback(value);public static LogRegion ScrollOffset(LogRegion logRegion, int value) #Sets LogRegion.ScrollOffset: Entries skipped from the newest end while scrolling; zero follows the newest entries.
Parameters
- logRegion ConsoleMonster.Widgets.LogRegion
- The instance.
- value int
- The value.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.LogRegion { ScrollOffset = value }; Ui.LogRegion().ScrollOffset(value);public static LogRegion ShowElapsed(LogRegion logRegion, bool value = true) #Sets LogRegion.ShowElapsed: Whether entries show their session time (default true).
Parameters
- logRegion ConsoleMonster.Widgets.LogRegion
- The instance.
- value bool = true
- The value; true when omitted.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.LogRegion { ShowElapsed = value }; Ui.LogRegion().ShowElapsed(value);public static LogRegion ShowTimestamp(LogRegion logRegion, bool value = true) #Sets LogRegion.ShowTimestamp: Shows source timestamps instead of session time; missing timestamps reserve a blank aligned cell.
Parameters
- logRegion ConsoleMonster.Widgets.LogRegion
- The instance.
- value bool = true
- The value; true when omitted.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.LogRegion { ShowTimestamp = value }; Ui.LogRegion().ShowTimestamp(value);public static LogRegion TimestampFormat(LogRegion logRegion, string value) #Sets LogRegion.TimestampFormat: Source timestamp format, using invariant culture (default ISO date, time, milliseconds and offset).
Parameters
- logRegion ConsoleMonster.Widgets.LogRegion
- The instance.
- value string
- The value.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.LogRegion { TimestampFormat = value }; Ui.LogRegion().TimestampFormat(value);public static LogRegion Wrap(LogRegion logRegion, bool value = true) #Sets 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 bool = true
- The value; true when omitted.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.LogRegion { Wrap = value }; Ui.LogRegion().Wrap(value);