Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
b4c69e0
rename: message type enum
reromanlee Oct 29, 2026
b49343d
refactor: core interface
reromanlee Oct 29, 2026
f98dae0
fix: source name lookup
reromanlee Oct 29, 2026
569cdd9
fix: stable message text
reromanlee Oct 29, 2026
6e55d26
fix: reentrant handlers
reromanlee Oct 29, 2026
95c126c
refactor: stack capture
reromanlee Oct 29, 2026
7afac64
feature: hidden frames
reromanlee Oct 29, 2026
5733a70
feature: log exceptions
reromanlee Oct 29, 2026
a7aa83b
feature: capture toggles
reromanlee Oct 29, 2026
49e98ad
feature: retention limit
reromanlee Oct 29, 2026
f2f621f
fix: per-instance order
reromanlee Oct 29, 2026
0771c55
feature: runtime settings
reromanlee Oct 29, 2026
ecf4dfb
feature: history cursors
reromanlee Oct 29, 2026
7e2e73a
create: message feed
reromanlee Oct 29, 2026
259816e
refactor: viewer listview
reromanlee Oct 29, 2026
cfe66fd
feature: viewer filters
reromanlee Oct 29, 2026
02a1223
feature: clear on play
reromanlee Oct 29, 2026
f6b6c74
feature: multiple windows
reromanlee Oct 29, 2026
49ebcfd
polish: window menu path
reromanlee Oct 29, 2026
b2a7e46
feature: settings page
reromanlee Oct 29, 2026
f7f3750
fix: settings name case
reromanlee Oct 29, 2026
77c2b53
refactor: apply search
reromanlee Oct 29, 2026
5e9f042
create: package tests
reromanlee Oct 29, 2026
43482e3
polish: meta newlines
reromanlee Oct 29, 2026
65163d4
update: unity 2022.3
reromanlee Oct 29, 2026
891d64a
create: ci test workflow
reromanlee Oct 29, 2026
3ca2089
polish: demo sample
reromanlee Oct 29, 2026
1c2b6fd
optimize: shared stacks
reromanlee Oct 29, 2026
aad2d57
test: call site stacks
reromanlee Oct 29, 2026
df921ba
docs: documentation pages
reromanlee Oct 29, 2026
e8f5de2
docs: refine readme
reromanlee Oct 29, 2026
9256a55
docs: reset changelog
reromanlee Oct 29, 2026
ead45ea
docs: precise claims
reromanlee Oct 29, 2026
1a3f0c2
fix: viewer reenable
reromanlee Oct 29, 2026
5cd29ef
release: version 1.0.0
reromanlee Oct 29, 2026
0db6974
fix: center type icons
reromanlee Oct 29, 2026
881899e
feature: row instances
reromanlee Oct 30, 2026
683906d
test: row instances
reromanlee Oct 30, 2026
fbca12a
docs: row instances
reromanlee Oct 30, 2026
0501f97
docs: demo gif
reromanlee Oct 30, 2026
3256050
fix: ci cli rate limit
reromanlee Oct 30, 2026
9ded3e4
security: pin ci actions
reromanlee Oct 30, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .github/ConsoleContainerDemo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed .github/readme-console-viewer.gif
Binary file not shown.
72 changes: 72 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Tests

on:
push:
branches: [main]
pull_request:
workflow_dispatch:

concurrency:
group: tests-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read
checks: write

jobs:
unity:
name: Unity ${{ matrix.unityVersion }} ${{ matrix.testMode }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# Keep in sync with the minimum version in UnityPackage/package.json and the latest supported LTS.
unityVersion: [2022.3.62f3, 6000.0.85f1]
testMode: [EditMode, PlayMode]
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
steps:
# Secrets are unavailable to forks and to repositories that have not set them up yet; the job then
# passes with a notice instead of failing, so the workflow stays inert until a license is configured.
- name: Check Unity license
id: license
run: |
if [ -n "$UNITY_LICENSE" ]; then
echo "available=true" >> "$GITHUB_OUTPUT"
else
echo "available=false" >> "$GITHUB_OUTPUT"
echo "::notice::Unity tests skipped. Add the UNITY_LICENSE, UNITY_EMAIL and UNITY_PASSWORD repository secrets to run them."
fi

# Actions and the game-ci CLI are pinned to exact versions, so the code that receives the Unity secrets
# changes only through a reviewed commit here.
- name: Checkout
if: steps.license.outputs.available == 'true'
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0

- name: Run tests
if: steps.license.outputs.available == 'true'
uses: game-ci/unity-test-runner@32e57712352b500e17974b245a6dce9e11a73213 # v4.4.0
# A "latest" cliVersion is resolved through the GitHub API, which the action authenticates only via this
# variable, not the githubToken input; unauthenticated calls hit the shared runner IP rate limit (403).
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
cliVersion: v0.1.72
packageMode: true
projectPath: UnityPackage
unityVersion: ${{ matrix.unityVersion }}
testMode: ${{ matrix.testMode }}
artifactsPath: artifacts
githubToken: ${{ secrets.GITHUB_TOKEN }}
checkName: Unity ${{ matrix.unityVersion }} ${{ matrix.testMode }} results

- name: Upload results
if: always() && steps.license.outputs.available == 'true'
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: test-results-${{ matrix.unityVersion }}-${{ matrix.testMode }}
path: artifacts
150 changes: 28 additions & 122 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,122 +1,28 @@
# Changelog

All notable changes to this package are documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Changed

- **The package now lives in the repository's `UnityPackage/` folder.** Git URL
installs must add `?path=/UnityPackage`
(`https://github.com/reromanlee/ConsoleContainer.git?path=/UnityPackage`); an
unpinned URL without it no longer resolves. Installs pinned to `#1.2.0` or
earlier keep working unchanged.

## [1.2.0] - 2026-08-11

### Added

- **`ConsoleInstance.Created`** — a static event raised right after any instance
finishes constructing, so one subscriber can attach to every instance the
application will ever create, including the ones built later by nested scopes.
Previously a subscriber had to be wired up at each construction site, which
meant a console added later silently went unobserved — the failure mode that
matters most when that subscriber is a crash handler. Handlers see a fully
built instance, run on the constructing thread, and one that throws is reported
through `Debug.LogException` without disturbing the construction that triggered
it. Subscriptions are static and live as long as the domain does.

## [1.1.0] - 2026-08-11

### Added

- **Message events** — `IConsoleInstance` now raises `MessageCreated` for every
message and `ErrorCreated` for errors, so application code can react to what it
logs (raising a soft crash screen with the error as its reason, for example).
Both fire in player builds as well as the editor, on the thread that logged the
message; a handler that throws is reported through `Debug.LogException` without
disturbing the logging call, and `Dispose` drops every handler. In a build the
`ConsoleMessage` is only allocated when something is subscribed.
- **Parameterless `ConsoleInstance` constructor** — dependency-injection
containers can resolve `IConsoleInstance` by convention instead of failing to
supply the optional name ([#3]).
- **Editor logging settings** — `ConsoleContainerSettings` gained an *Editor
logging* section: a forwarding mode (`Never`, `During Test Runs`, `Always`) and
per-type toggles. Defaulting to *During Test Runs* makes messages show up in the
Test Runner window for the length of a run while leaving the Unity Console clean
the rest of the time, and it works without a settings asset ([#5]). Test-run
detection lives in a separate assembly gated on the Unity Test Framework, so
projects without that package are unaffected.
- **Per-window view state** — each Console Viewer window remembers its splitter
sizes, selected instance and scroll position across domain reloads and editor
restarts, and re-attaches to a recreated instance by name ([#7]).

### Fixed

- Instances that share a name no longer collapse into a single dropdown entry
where picking one silently showed another; duplicates are numbered
(`Networking`, `Networking (2)`) ([#4]).
- Disposed instances no longer linger in the dropdown once they have nothing to
show. An instance is dropped when it is disposed while empty, or cleared after
being disposed, so repeated test runs without a domain reload stop stacking
stale entries in front of freshly created ones ([#6]).
- The registry's version counters are now incremented atomically; concurrent
logging could previously lose an update and leave the viewer out of date.
- Loading the settings asset no longer risks touching the main-thread-only
`Resources` API from a background thread, and edits to the asset take effect
without waiting for a domain reload.
- The window title, icon and minimum size are re-applied whenever the window is
enabled, so a viewer restored from a saved layout keeps them.

## [1.0.0] - 2026-07-09

Initial release.

### Added

- **Console instances** — `ConsoleInstance` implementing `IConsoleInstance`,
with an optional name passed to the constructor for the viewer dropdown.
- **Three message types** — `CreateText`, `CreateWarning` and `CreateError`,
each with `object` and `string` source overloads plus `params string[]`
content. Source resolves to the string, or the object's type name; content is
the arguments joined by single spaces; the label is `{source}: {content}`.
- **Thread-safe logging** — every `Create*` call is safe from any thread
(jobs, background threads, async), guarded by per-instance locking, an atomic
global sequence number and a thread-safe editor registry.
- **Console Viewer window** (`Tools ▸ Console Viewer`):
- Instance dropdown with an **All Instances** entry that merges every
instance's messages in chronological order.
- `Text` / `Warning` / `Error` rows rendered from visual tree assets, with
per-type icons/colors, `[HH:mm:ss]` timestamps and even-row zebra striping.
- Message selection: the details pane shows the full `{source}: {content}`
text followed by the complete stack trace (like the Unity Console), a
**Copy** button, and the same call stack rendered on the left as buttons
that open the file at its line in the external IDE (top button = the log
call site).
- **Clear** button that clears the selected instance, or all of them when
*All Instances* is selected.
- Incremental rendering (append-only) with auto-scroll when pinned to the
bottom; full rebuilds only on instance-set or clear changes.
- Instances and their messages remain viewable after Play Mode ends (flagged
`(disposed)` in the dropdown) until the next domain reload.
- **Editor vs. player build separation** — in the editor, messages appear only
in the Console Viewer and never reach the Unity Console.
- **Optional build logging** — `ConsoleContainerSettings` ScriptableObject
(Assets ▸ Create ▸ ConsoleContainer ▸ Settings) with an independent toggle per
message type. In player builds, enabled types are forwarded as
`Debug.Log` / `Debug.LogWarning` / `Debug.LogError` of `{source}: {content}`;
with no settings asset in the build, all messages stay hidden.
- **Console Container Demo sample** — an importable MonoBehaviour that logs to
several named instances continuously, including from a background thread.

[1.0.0]: https://github.com/reromanlee/ConsoleContainer/releases/tag/1.0.0
[1.1.0]: https://github.com/reromanlee/ConsoleContainer/releases/tag/1.1.0
[1.2.0]: https://github.com/reromanlee/ConsoleContainer/releases/tag/1.2.0
[#3]: https://github.com/reromanlee/ConsoleContainer/issues/3
[#4]: https://github.com/reromanlee/ConsoleContainer/issues/4
[#5]: https://github.com/reromanlee/ConsoleContainer/issues/5
[#6]: https://github.com/reromanlee/ConsoleContainer/issues/6
[#7]: https://github.com/reromanlee/ConsoleContainer/issues/7
# ConsoleContainer 1.0.0

### What's new

1. Named console instances: `ConsoleInstance` behind a small `IConsoleInstance` interface, logged to through `CreateText`, `CreateWarning` and `CreateError` extension methods with single-message and content overloads, and a string, `Type` or object as the source.
2. Console Viewer window (Window ▸ General ▸ Console Viewer): a virtualized list of one instance or all of them merged chronologically with each message's instance named, type filters with counts, search, a details pane with clickable call stack frames, Copy and Ctrl+C, Clear and Clear on Play, several windows side by side, remembered per-window state, and Dark and Light skin support.
3. `MessageCreated` and `ErrorCreated` events in the editor and player builds, plus the static `ConsoleInstance.Created` to cover every instance at once; throwing handlers are reported without breaking logging, and runaway re-entrant logging is stopped before it can overflow the stack.
4. `CreateException`, which shows where an exception was thrown, hands the original object to handlers through `ConsoleMessage.Exception`, and is forwarded through `Debug.LogException`.
5. Dropped messages in player builds allocate nothing, and a `ConsoleMessage` is only created when a handler is subscribed for its type.
6. Per-type forwarding to the Unity log through an optional settings asset: nothing reaches player logs without one, and in the editor messages are forwarded during test runs only, so they show in the Test Runner window while the Unity Console stays clean.
7. Bounded editor history, 10,000 messages per instance by default, read through per-instance cursors so the viewer never skips a message under concurrent logging.
8. Call stacks that start at the logging call, skip wrappers marked `[HideInCallstack]`, name lambdas and iterators after their method, can be turned off per message type, and are shared between messages logged along the same path.
9. Project Settings ▸ Console Container page that creates the settings asset where the runtime finds it and warns about ignored, editor-only or duplicate assets; `ConsoleContainerSettings.Active` accepts runtime overrides.
10. Thread-safe logging from any thread, culture-independent time text, and cached message text.
11. Console Container Demo sample, Edit Mode and Play Mode test suites, and a GameCI workflow.
12. Unity 2022.3 LTS and Unity 6 support; safe under Mono, IL2CPP, managed code stripping and WebGL.

### Important

1. The package lives in the `UnityPackage/` folder of the repository, so git URL installs must end with `?path=/UnityPackage`.

### Upgrading from internal builds

1. `MessageType` is now `ConsoleMessageType`, so it no longer clashes with `UnityEditor.MessageType`.
2. Custom `IConsoleInstance` implementations must implement the new core members; calls to `CreateText`, `CreateWarning` and `CreateError` compile unchanged.
3. The Console Viewer moved from Tools ▸ Console Viewer to Window ▸ General ▸ Console Viewer.
4. The `ConsoleMessage` constructor is now internal, and a message without content is labelled with its source alone.
5. Editor history is capped at 10,000 messages per instance, and Clear on Play is on by default.
Loading
Loading