File tree Expand file tree Collapse file tree 3 files changed +38
-0
lines changed
src/main/kotlin/com/coder/toolbox Expand file tree Collapse file tree 3 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,11 @@ interface ReadOnlyCoderSettings {
38
38
*/
39
39
val fallbackOnCoderForSignatures: SignatureFallbackStrategy
40
40
41
+ /* *
42
+ * Controls the logging for the rest client.
43
+ */
44
+ val httpClientLogLevel: HttpLoggingVerbosity
45
+
41
46
/* *
42
47
* Default CLI binary name based on OS and architecture
43
48
*/
@@ -216,4 +221,32 @@ enum class SignatureFallbackStrategy {
216
221
else -> NOT_CONFIGURED
217
222
}
218
223
}
224
+ }
225
+
226
+ enum class HttpLoggingVerbosity {
227
+ NONE ,
228
+
229
+ /* *
230
+ * Logs URL, method, and status
231
+ */
232
+ BASIC ,
233
+
234
+ /* *
235
+ * Logs BASIC + sanitized headers
236
+ */
237
+ HEADERS ,
238
+
239
+ /* *
240
+ * Logs HEADERS + body content
241
+ */
242
+ BODY ;
243
+
244
+ companion object {
245
+ fun fromValue (value : String? ): HttpLoggingVerbosity = when (value?.lowercase(getDefault())) {
246
+ " basic" -> BASIC
247
+ " headers" -> HEADERS
248
+ " body" -> BODY
249
+ else -> NONE
250
+ }
251
+ }
219
252
}
Original file line number Diff line number Diff line change 1
1
package com.coder.toolbox.store
2
2
3
3
import com.coder.toolbox.settings.Environment
4
+ import com.coder.toolbox.settings.HttpLoggingVerbosity
4
5
import com.coder.toolbox.settings.ReadOnlyCoderSettings
5
6
import com.coder.toolbox.settings.ReadOnlyTLSSettings
6
7
import com.coder.toolbox.settings.SignatureFallbackStrategy
@@ -42,6 +43,8 @@ class CoderSettingsStore(
42
43
get() = store[DISABLE_SIGNATURE_VALIDATION ]?.toBooleanStrictOrNull() ? : false
43
44
override val fallbackOnCoderForSignatures: SignatureFallbackStrategy
44
45
get() = SignatureFallbackStrategy .fromValue(store[FALLBACK_ON_CODER_FOR_SIGNATURES ])
46
+ override val httpClientLogLevel: HttpLoggingVerbosity
47
+ get() = HttpLoggingVerbosity .fromValue(store[HTTP_CLIENT_LOG_LEVEL ])
45
48
override val defaultCliBinaryNameByOsAndArch: String get() = getCoderCLIForOS(getOS(), getArch())
46
49
override val binaryName: String get() = store[BINARY_NAME ] ? : getCoderCLIForOS(getOS(), getArch())
47
50
override val defaultSignatureNameByOsAndArch: String get() = getCoderSignatureForOS(getOS(), getArch())
Original file line number Diff line number Diff line change @@ -14,6 +14,8 @@ internal const val DISABLE_SIGNATURE_VALIDATION = "disableSignatureValidation"
14
14
15
15
internal const val FALLBACK_ON_CODER_FOR_SIGNATURES = " signatureFallbackStrategy"
16
16
17
+ internal const val HTTP_CLIENT_LOG_LEVEL = " httpClientLogLevel"
18
+
17
19
internal const val BINARY_NAME = " binaryName"
18
20
19
21
internal const val DATA_DIRECTORY = " dataDirectory"
You can’t perform that action at this time.
0 commit comments