Skip to content

Remove dead import OSLog from demo command files#134

Merged
odrobnik merged 1 commit into
mainfrom
claude/remove-dead-oslog-imports
Jun 9, 2026
Merged

Remove dead import OSLog from demo command files#134
odrobnik merged 1 commit into
mainfrom
claude/remove-dead-oslog-imports

Conversation

@odrobnik

@odrobnik odrobnik commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Summary

import OSLog should appear only where Swift Logging is bridged to OSLog — the OSLogHandler and LoggingSystem.bootstrapWithOSLog() helpers. The six demo subcommands and MCPCommand only call bootstrapWithOSLog(), which needs no OSLog import. The stray import OSLog in those files was dead — and it shadowed Logging.Logger with os.Logger (the reason the lifecycle-logger lines needed Logging.Logger qualification in #133).

What changed

Removed the #if canImport(OSLog) import OSLog #endif blocks from:

  • SwiftMCPDemo: MCPCommand, HTTPSSECommand, StdioCommand, TCPBonjourCommand
  • SwiftMCPIntentsDemo: HTTPSSECommand, StdioCommand, TCPBonjourCommand

Kept the #if canImport(OSLog) guard around the Apple-only bootstrapWithOSLog() calls. import OSLog now lives only in the bridge files (OSLogHandler.swift / LoggingSystem.swift).

7 files, −22 lines, no functional change.

Verification

  • swift build (default traits) — green; the call sites compile without the import, proving it was dead
  • grep "import OSLog" → only the 4 bridge files remain

🤖 Generated with Claude Code

`import OSLog` is only needed where Swift Logging is bridged to OSLog —
the `OSLogHandler` and `LoggingSystem.bootstrapWithOSLog()` helpers. The
six demo subcommands and `MCPCommand` only *call* `bootstrapWithOSLog()`,
which requires no OSLog import, so the import was dead (and it shadowed
`Logging.Logger` with `os.Logger`).

Drop the `#if canImport(OSLog) import OSLog #endif` blocks from those
files, keeping the `#if canImport(OSLog)` guard around the Apple-only
`bootstrapWithOSLog()` calls. `import OSLog` now appears only in the
bridge files (OSLogHandler.swift / LoggingSystem.swift).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@odrobnik odrobnik merged commit c8dade5 into main Jun 9, 2026
7 checks passed
@odrobnik odrobnik deleted the claude/remove-dead-oslog-imports branch June 9, 2026 18:20
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