# Swift Logging Pro

> Reviews Swift logging code using os.Logger for correct privacy markers, subsystem/category conventions, and appropriate log levels. Use when writing or reviewing logging code.

- **Type:** Skill
- **Install:** `agentstack add skill-kelvinkosbab-appbootstrapai-swift-logging-pro`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [kelvinkosbab](https://agentstack.voostack.com/s/kelvinkosbab)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [kelvinkosbab](https://github.com/kelvinkosbab)
- **Source:** https://github.com/kelvinkosbab/AppBootstrapAI/tree/main/.claude/skills/swift-logging-pro

## Install

```sh
agentstack add skill-kelvinkosbab-appbootstrapai-swift-logging-pro
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

Review Swift logging code for correctness, privacy compliance, and consistent subsystem conventions. Report only genuine problems - do not nitpick or invent issues.

Review process:

1. Check `os.Logger` usage and subsystem/category conventions using `references/os-logger.md`.
1. Validate privacy markers on logged values using `references/privacy.md`.
1. Verify log level choice matches the message severity using `references/log-levels.md`.
1. Flag `print()` statements in production code (acceptable in tests, scripts).

If doing a partial review, load only the relevant reference files.

## Core Instructions

- Use `os.Logger` (modern API), not `OSLog` (legacy) or `print()` (no privacy, no levels, no subsystem filtering).
- Always specify `subsystem` (typically reverse-DNS bundle ID) and `category` (component name) when creating a `Logger`.
- All interpolated values default to `private` — explicitly mark with `.public` only when safe (e.g., status enums, fixed strings).
- Never log usernames, passwords, tokens, email addresses, or PII — even with `.public`.
- Use the appropriate level: `.debug` for development noise, `.info` for normal events, `.notice` for important events, `.error` for recoverable failures, `.fault` for programmer errors.
- A single `Logger` instance per type/category — store as `static let` to avoid re-creating on each log call.

## Output Format

Organize findings by file. For each issue:

1. State the file and relevant line(s).
2. Name the rule being violated.
3. Show a brief before/after code fix.

Skip files with no issues. End with a prioritized summary of the most impactful changes to make first.

Example output:

### MyService.swift

**Line 18: Privacy violation — user identifier logged as `.public`.**

```swift
// Before
logger.info("Loaded user \(userId, privacy: .public)")

// After
logger.info("Loaded user \(userId, privacy: .private)")
```

**Line 34: Use `.error` level for recoverable failures, not `.info`.**

```swift
// Before
logger.info("Network request failed: \(error.localizedDescription)")

// After
logger.error("Network request failed: \(error.localizedDescription)")
```

**Line 45: `print()` statement in production code — replace with `Logger`.**

```swift
// Before
print("Cache miss for key \(key)")

// After
logger.debug("Cache miss for key \(key, privacy: .public)")
```

### Summary

1. **Privacy (high):** User-identifying data logged as `.public` on line 18 — change to `.private`.
2. **Severity (medium):** Recoverable failure logged at `.info` — should be `.error`.
3. **Modernization (low):** `print()` statement should use `Logger`.

End of example.

## References

- `references/os-logger.md` — `os.Logger` basics, subsystem/category conventions, instance creation patterns.
- `references/privacy.md` — `.public`, `.private`, `.sensitive` markers, redaction, what never to log.
- `references/log-levels.md` — `.debug`, `.info`, `.notice`, `.error`, `.fault` semantics, performance impact.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [kelvinkosbab](https://github.com/kelvinkosbab)
- **Source:** [kelvinkosbab/AppBootstrapAI](https://github.com/kelvinkosbab/AppBootstrapAI)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-kelvinkosbab-appbootstrapai-swift-logging-pro
- Seller: https://agentstack.voostack.com/s/kelvinkosbab
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
