Skip to content

fix(log): readable auto-hide and hide-failure lines in Console - #554

Merged
tieubao merged 6 commits into
developfrom
fix/public-log-lines
Nov 18, 2026
Merged

tieubao merged 6 commits into
developfrom
fix/public-log-lines

Conversation

@tieubao

@tieubao tieubao commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

On macOS 27 every NSLog line from Hidden Bar shows as <private> in the unified log, so Console and log show are empty for a user who wants to report a stuck bar. This makes a small, fixed set of lines readable there and documents how to capture the rest.

What changes

  • AppLog.publicLine(_:) takes a StaticString, so the compiler rejects any text built at run time. It writes to the unified log as public and to stderr once.
  • Public lines: the auto-hide hold reasons, the popup guard hold and its time limit, the hide request that macOS never answers, and the fixed "hiding unavailable" causes.
  • Everything with data in it (bundle ids, layers, app names, paths) stays in the private NSLog line next to it.
  • The "runs outside Applications" detail line now shows the path with ~, because captured logs get attached to issues.
  • docs/MANUAL.md gains "Capture a log": open --stderr ~/Desktop/hiddenbar.log "/Applications/Hidden Bar.app".

Why not make every line public

The first version of this branch did that (commit 3d9c509, reverted by 79ab40f). It would have put the list of the user's menu bar apps into Console and sysdiagnoses. Private stays the default.

Tests

Run in the mac-ui VM, Hidden Bar scheme, Debug-Direct:

  • AppLogTests, AutoCollapsePopupGuardTests, AutoStartTests: 32 passed.
  • MenuBarEngineTests, RevealControllerTests: 24 passed.
  • Negative control: a guard that logs its public line on every timer fire fails two tests.
  • Both schemes build for testing.
  • Guest proof with a small CLI built from Constant.swift: the NSLog line shows <private>, the publicLine line shows its text.

Not yet checked: the real app's lines in Console on macOS 27. A VM run of the develop build follows.

Foundation's NSLog marks every value <private> on recent macOS, so Console
and log show only printed <private>. A module-level NSLog now logs the
message with os_log %{public}@ under the app's bundle id and writes the same
line to stderr, as before. The Objective-C shim does the same by hand.
The macOS 27 unavailable line logged the full app path; it now logs it with
the home folder as ~, since the log is public.
NSLog stays private in the unified log. AppLog.publicLine takes a
StaticString, so no run-time data can reach the public log, and also writes
the line to stderr. The five auto-collapse hold reasons, the popup guard hold
and cap, the hiding unavailable reasons and the collapse timeout use it; lines
that carry data keep their private line beside it.
@tieubao
tieubao merged commit cf81a7d into develop Nov 18, 2026
3 checks passed
@tieubao
tieubao deleted the fix/public-log-lines branch November 18, 2026 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant