diff --git a/readeck/UI/Components/CoreDataTagManagementView.swift b/readeck/UI/Components/CoreDataTagManagementView.swift index b3fd97d..24f630b 100644 --- a/readeck/UI/Components/CoreDataTagManagementView.swift +++ b/readeck/UI/Components/CoreDataTagManagementView.swift @@ -174,7 +174,7 @@ struct CoreDataTagManagementView: View { alignment: .top, spacing: 8 ) { - ForEach(tagEntities) { entity in + ForEach(tagEntities, id: \.objectID) { entity in if let name = entity.name, shouldShowTag(name) { UnifiedLabelChip( label: name, diff --git a/readeck/Utils/Logger.swift b/readeck/Utils/Logger.swift index 9f1feb1..16873af 100644 --- a/readeck/Utils/Logger.swift +++ b/readeck/Utils/Logger.swift @@ -52,6 +52,19 @@ class LogConfiguration: ObservableObject { @Published var isLoggingEnabled = false private init() { + // First time setup: Enable logging in DEBUG builds with sensible defaults + #if DEBUG + if UserDefaults.standard.object(forKey: "LogConfigurationInitialized") == nil { + isLoggingEnabled = true + showPerformanceLogs = true + showTimestamps = true + includeSourceLocation = true + globalMinLevel = .debug + UserDefaults.standard.set(true, forKey: "LogConfigurationInitialized") + saveConfiguration() + } + #endif + loadConfiguration() } @@ -81,12 +94,22 @@ class LogConfiguration: ObservableObject { } } } - + globalMinLevel = LogLevel(rawValue: UserDefaults.standard.integer(forKey: "LogGlobalLevel")) ?? .debug - showPerformanceLogs = UserDefaults.standard.bool(forKey: "LogShowPerformance") - showTimestamps = UserDefaults.standard.bool(forKey: "LogShowTimestamps") - includeSourceLocation = UserDefaults.standard.bool(forKey: "LogIncludeSourceLocation") - isLoggingEnabled = UserDefaults.standard.bool(forKey: "LogIsEnabled") + + // Load boolean settings with defaults + if UserDefaults.standard.object(forKey: "LogShowPerformance") != nil { + showPerformanceLogs = UserDefaults.standard.bool(forKey: "LogShowPerformance") + } + if UserDefaults.standard.object(forKey: "LogShowTimestamps") != nil { + showTimestamps = UserDefaults.standard.bool(forKey: "LogShowTimestamps") + } + if UserDefaults.standard.object(forKey: "LogIncludeSourceLocation") != nil { + includeSourceLocation = UserDefaults.standard.bool(forKey: "LogIncludeSourceLocation") + } + if UserDefaults.standard.object(forKey: "LogIsEnabled") != nil { + isLoggingEnabled = UserDefaults.standard.bool(forKey: "LogIsEnabled") + } } private func saveConfiguration() {