Skip to content

Conversation

@ssestak
Copy link
Collaborator

@ssestak ssestak commented Nov 13, 2025

Summary

  • Add configurable minimum log level threshold to LoggerConfiguration
  • Implement native os.log filtering behavior (only logs at or above threshold are shown)
  • Support for debug, info, error, and fault log levels

Changes

New LogLevel Enum

  • .debug - Show all logs (lowest priority)
  • .info - Show info, error, and fault logs
  • .error - Show error and fault logs only
  • .fault - Show only fault logs (highest priority)

Updated LoggerConfiguration

  • Added logLevel parameter (defaults to .debug for backward compatibility)
  • Platform-specific initializers for os.log availability
  • Implements shouldLog() method for threshold checking

Updated FTNetworkTracer

  • Check log level threshold before logging
  • Only logs entries that meet or exceed configured minimum level

Example Usage

// Only log errors and faults in production
let logger = LoggerConfiguration(
    subsystem: "com.yourapp",
    category: "network",
    logLevel: .error
)

let tracer = FTNetworkTracer(logger: logger, analytics: analytics)

Test Plan

  • All existing tests pass (67 tests)
  • Build succeeds on macOS
  • Cross-platform compatibility (conditional compilation)

Documentation

  • Added inline documentation for LogLevel enum
  • Updated LoggerConfiguration docs with logLevel parameter

🤖 Generated with Claude Code

Add a `LogLevel` enum to `LoggerConfiguration` to allow filtering log messages based on their severity, preventing lower-priority messages from being processed and emitted when not desired.feat(logging): Introduce log level filtering for FTNetworkTracer
Add a `LogLevel` enum to `LoggerConfiguration` to allow filtering log messages based on their severity, preventing lower-priority messages from being processed and emitted when not desired.
@ssestak ssestak merged commit 845bc88 into main Nov 13, 2025
2 of 4 checks passed
@ssestak ssestak deleted the feature/Add-log-level-filtering branch November 13, 2025 09:51
@ssestak ssestak mentioned this pull request Nov 13, 2025
6 tasks
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.

2 participants