forked from github/CopilotForXcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLoggingSection.swift
More file actions
52 lines (48 loc) · 1.51 KB
/
LoggingSection.swift
File metadata and controls
52 lines (48 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import Logger
import SwiftUI
struct LoggingSection: View {
@AppStorage(\.verboseLoggingEnabled) var verboseLoggingEnabled: Bool
@State private var shouldPresentRestartAlert = false
var verboseLoggingBinding: Binding<Bool> {
Binding(
get: { verboseLoggingEnabled },
set: {
verboseLoggingEnabled = $0
shouldPresentRestartAlert = $0
}
)
}
var body: some View {
SettingsSection(title: "Logging") {
SettingsToggle(
title: "Verbose Logging",
isOn: verboseLoggingBinding
)
Divider()
SettingsLink(
URL(fileURLWithPath: FileLoggingLocation.path.string),
title: "Open Copilot Log Folder"
)
.environment(\.openURL, OpenURLAction { url in
NSWorkspace.shared.open(url)
return .handled
})
}
.alert(isPresented: $shouldPresentRestartAlert) {
Alert(
title: Text("Quit And Restart Xcode"),
message: Text(
"""
Logging level changes will take effect the next time Copilot \
for Xcode is started. To update logging now, please quit \
Copilot for Xcode and restart Xcode.
"""
),
dismissButton: .default(Text("OK"))
)
}
}
}
#Preview {
LoggingSection()
}