-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathLoggingSettingsView.swift
More file actions
63 lines (59 loc) · 2.1 KB
/
LoggingSettingsView.swift
File metadata and controls
63 lines (59 loc) · 2.1 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
53
54
55
56
57
58
59
60
61
62
63
import AppKit
import Logger
import Preferences
import SwiftUI
struct LoggingSettingsView: View {
@AppStorage(\.verboseLoggingEnabled) var verboseLoggingEnabled: Bool
@State private var shouldPresentRestartAlert = false
var body: some View {
VStack(alignment: .leading) {
Text("Logging")
.bold()
.padding(.leading, 8)
VStack(spacing: .zero) {
HStack(alignment: .center) {
Text("Verbose Logging")
.padding(.horizontal, 8)
Spacer()
Toggle(isOn: $verboseLoggingEnabled) {
}
.toggleStyle(.switch)
.padding(.horizontal, 8)
}
.padding(.vertical, 8)
.onChange(of: verboseLoggingEnabled) { _ in
shouldPresentRestartAlert = true
}
Divider()
HStack {
Text("Open Copilot Log Folder")
.font(.body)
Spacer()
Image(systemName: "chevron.right")
}
.onTapGesture {
NSWorkspace.shared.open(URL(fileURLWithPath: FileLoggingLocation.path.string, isDirectory: true))
}
.foregroundStyle(.primary)
.padding(.horizontal, 8)
.padding(.vertical, 10)
}
.background(Color.gray.opacity(0.1))
.cornerRadius(8)
}
.padding(.horizontal, 20)
.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"))
)
}
}
}