logging-guidelines

The DuckDuckGo browser apps for iOS and macOS leverage Apple's Unified Logging System for capturing telemetry and debugging information. This system enables efficient tracking of app behavior, issue diagnosis, and performance monitoring in a structured and privacy-conscious manner.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/duckduckgo/apple-browsers/logging-guidelines
Clone the repo
git clone --depth 1 https://github.com/duckduckgo/apple-browsers

Made for: Cursor.

Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 3,679 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.03679
Opus 5 $0.00000 $0.01840
Sonnet 5 $0.00000 $0.00736
Haiku 4.5 $0.00000 $0.00368

Measured yesterday against content hash f7e1a4017eac, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade B, and why

logging-guidelines scanned grade B with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Asks for rootmediumPrivilege escalation

A mod that escalates privileges can change anything on the machine, not only the project.

sudo sysdiagnose
.cursor/rules/logging-guidelines.mdc · 577 lines

How it starts

The opening of the file, as written. The whole thing — 577 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Logging Guidelines & Telemetry Capture

Overview

The DuckDuckGo browser apps for iOS and macOS leverage Apple's Unified Logging System for capturing telemetry and debugging information. This system enables efficient tracking of app behavior, issue diagnosis, and performance monitoring in a structured and privacy-conscious manner.

Key Benefits:

  • Privacy-first: Built-in privacy controls for sensitive data
  • Performance: Optimized for minimal overhead
  • Integration: Native Apple ecosystem support
  • Debugging: Rich contextual information and filtering

How to Log

Using the Logger Class

We utilize the Logger class from Apple's os framework for all logging activities:

import os

// Basic logging examples
Logger.yourFeatureName.debug("Something to log, with info: \(infoVar)")
Logger.anotherFeatureName.error("Some error happened: \(error.localizedDescription, privacy: .public)")
Logger.networking.info("API request completed for endpoint: \(endpoint, privacy: .public)")
Logger.performance.debug("Operation took \(duration)ms to complete")

Creating Custom Loggers

Single Feature Logger

For new features, create a dedicated logger file named Logger+YourFeatureName.swift:

import os

public extension Logger {
    static var yourFeatureName: Logger = { 
        Logger(subsystem: "Your Feature Name", category: "") 
    }()
    
    static var anotherFeatureName: Logger = { 
        Logger(subsystem: "Another feature name", category: "Subsystem in the feature") 
    }()
}
Multiple Feature Loggers

For related features, add to existing logger extensions (e.g., Logger+Multiple.swift):

import os

public extension Logger {
    // Networking loggers
    static var networking: Logger = { 
        Logger(subsystem: "Networking", category: "API") 
    }()
    
    static var cache: Logger = { 
        Logger(subsystem: "Networking", category: "Cache") 
    }()
    
    // UI loggers  
    static var tabManagement: Logger = { 
        Logger(subsystem: "UI", category: "Tab Management") 
    }()
    
    static var bookmarks: Logger = { 
        Logger(subsystem: "UI", category: "Bookmarks") 
    }()
}

Read the full file on GitHub · 577 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 577 lines · 0 tokens per session scan B f7e1a4017eac

Subscribe to this mod's changes

logging-guidelines is a cursor rule published in the GitHub repository duckduckgo/apple-browsers (252 stars, last pushed yesterday), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 3,679 tokens. A static security scan graded it B with 1 finding (asks for root). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-01.