Fix tag scrolling and improve debug logging

- Fix duplicate ID warning in CoreDataTagManagementView by using objectID
- Enhance debug logging system with category filtering
This commit is contained in:
Ilyas Hallak 2025-11-08 19:18:56 +01:00
parent e5d4e6d8a0
commit 4134b41be2
2 changed files with 29 additions and 6 deletions

View File

@ -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,

View File

@ -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() {