Feat(client): report macOS runtime logs to the controller
macOS already handled COMMAND_QUERY_LOG and opened the sub-connection that sends TOKEN_REPORT_LOG, but the snapshot was always empty: macOS Mprintf went to NSLog/fprintf(stderr) and never through Logger, so the ring it dumps stayed empty and both the 运行日志 dialog and MCP get_client_log got nothing. macOS now writes Logger like Linux does, with enable=false so no second log file appears under ~/.config/ghost, and Logger mirrors each line to stderr, which main.mm already redirects to /tmp/ghost.log in daemon and App bundle mode. Prefix and timestamp match on both sides, so dialog and file can be compared line for line. main.mm logged its own lifecycle through NSLog, which never reaches the ring, so the lines people open the dialog for were missing; those calls now use Mprintf. The ObjC helpers (ScreenHandler/H264Encoder/InputHandler/Permissions) keep NSLog and stay file-only. POSIX reports one snapshot per connection, so reopening 运行日志 takes a fresh one; Windows keeps pushing every 3s. Verified with a WSL probe built with -D__APPLE__ (ring, incremental dump, stderr mirror), a MinGW probe for the _WIN32 branch, and a green Linux client rebuild. Not built or run on a real Mac. Co-Authored-By: deepseek-flash
This commit is contained in:
1 parent
b743de6747
commit
a25e89b220
4 files changed
+102
-38
No files matched your search
@@ -951,6 +951,17 @@ schema 里写明这一点;同时根键分支补上 `path: ""`,让两个分
|
||||
`MessageHandle` 的 `TOKEN_REPORT_LOG` 分支取走首包后会 `CancelIO` 关掉这条连接,回在
|
||||
主连接上就是把主连接关掉(客户端当场掉线)。
|
||||
|
||||
macOS 还有第二层问题,只影响日志内容,2026-11-14 修:处理器虽然接上了,但 `Logger` 的
|
||||
ring 只能被 `Mprintf` 写入,而 macOS 的 `Mprintf` 当时直接走 `NSLog`/`fprintf(stderr)`,
|
||||
从不经过 `Logger`——ring 恒为空,菜单和 `get_client_log` 拿到的都是空快照。现在 macOS 的
|
||||
`Mprintf`(由 `common/logger.h` 定义)与 Linux 一样写 `Logger`(ring;`enable=false` 不另
|
||||
建日志文件),再由 `Logger` 把同一行镜像到 stderr(即 `/tmp/ghost.log`),同一条 Mprintf
|
||||
在文件与菜单里的文本、前缀、时间戳完全一致;ring 只留最近 1000 行,更早的内容只在文件
|
||||
里。`macos/main.mm` 里原先用 `NSLog` 的启动/配置/权限等生命周期行也一并改成 `Mprintf`,
|
||||
否则菜单里看不到现场最常翻的那几行;`ScreenHandler`/`H264Encoder`/`InputHandler` 等 ObjC
|
||||
模块的 `NSLog` 不动,它们和两条直接 `write(2)` 的启动横幅仍只出现在 `/tmp/ghost.log`。
|
||||
MFC 的「运行日志」对话框与 MCP 的 `get_client_log` 走同一条链路,两端同时可用。
|
||||
|
||||
### 18.4 验证与未覆盖
|
||||
|
||||
- 服务端 21:17:21 构建 + 两端客户端重编后实测:`ids` 批量(`get_host_detail` /
|
||||
|
||||
Reference in new issue
Block a user