UI Toolbox logoUI Toolbox
Support

LogView

A LogView is a log in a ListView: a toggle for each kind with its count, a text filter, Follow, Clear, and the whole message and stack trace of the selected entry in a vertical SplitPanel under the list. A ConsoleView is a LogView with a command line under it.

A log with level filters, a selected error and its stack trace belowA log with level filters, a selected error and its stack trace below

<UIToolbox.LogView capture-unity-log="true" max-items="500" />
log.Add(LogEntryKind.Warning, "Low memory", stackTrace);
log.Add(LogEntryKind.Command, "> spawn orc"); // shows with any kinds
// shows the new entries now
log.Refresh();
Member Description
Add(kind, message, stackTrace) Adds an entry and returns it. Add(message, stackTrace, LogType) takes a Unity log message; an exception and an assert count as errors. Call it on the main thread.
Clear() Removes all entries and shows the empty list at once.
Entries, Shown All entries, and the entries that the list shows after the filters.
Count(kind) The number of entries of a kind.
MaxItems (max-items) The most entries kept (1000), at least 1. The oldest go first.
CaptureUnityLog (capture-unity-log) True shows the messages of Application.logMessageReceivedThreaded while the view is on a panel. A worker thread message waits for the next refresh tick.
Follow (follow) True (the default) scrolls to each new entry.
ShowCopyButton (show-copy-button) On (the default): the bar has a Copy button.
Copy() Puts CopyText on the system clipboard and raises Copied with the text. The Copy button calls it.
CopyText The text for the clipboard. With a selected entry: its message and stack trace. With no selection: one line for each shown entry, with its time, its kind and its message.
ShowClearButton (show-clear-button) On (the default): the filter box shows a "x" button while it has text, and a click clears the text. Escape in the filter box also clears the text. See Clear button.
Refresh() Filters the entries again and shows them. The selection stays when its entry still shows.
Changed Raised after entries were added or cleared.
KindToggle(kind), FilterField, FollowToggle, List, Detail The parts, for code that changes them.

Styling

Class Element
tb-log-view The view (grows).
tb-log-view__bar The row of the kind toggles, the filter, Follow, Copy and Clear. A bar too narrow for them wraps.
tb-log-view__kind A kind toggle. Modifiers: --log, --warning, --error.
tb-log-view__filter The text filter. It takes the width that the other parts leave, and is at least 64 px wide.
tb-log-view__split The vertical SplitPanel of the list and the detail, with a --tb-color-border border.
tb-log-view__list The native ListView, on --tb-color-surface-alt.
tb-log-view__row A row. Modifiers: --log, --warning (--tb-color-warning text), --error (--tb-color-text-danger text), --command (bold).
tb-log-view__row-dot The dot of the kind: --tb-color-text-muted, the warning, the danger or the accent color.
tb-log-view__row-time The time, --tb-color-text-muted, right-aligned.
tb-log-view__row-message The first line of the message (ellipsis).
tb-log-view__detail-pane The ScrollView of the detail, under the list. It is at least 32 px high, so a message of one line shows with no scroll bar, also when the split is low.
tb-log-view__detail The whole message and stack trace of the selected entry (wraps, selectable).

The LogViewDemo scene shows a game log with a filter for each kind and a stack trace, a combat log with a line limit and its own colors, and the Unity log of the game.