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 {
3838 */
3939 val fallbackOnCoderForSignatures: SignatureFallbackStrategy
4040
41+ /* *
42+ * Controls the logging for the rest client.
43+ */
44+ val httpClientLogLevel: HttpLoggingVerbosity
45+
4146 /* *
4247 * Default CLI binary name based on OS and architecture
4348 */
@@ -216,4 +221,32 @@ enum class SignatureFallbackStrategy {
216221 else -> NOT_CONFIGURED
217222 }
218223 }
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+ }
219252}
Original file line number Diff line number Diff line change 11package com.coder.toolbox.store
22
33import com.coder.toolbox.settings.Environment
4+ import com.coder.toolbox.settings.HttpLoggingVerbosity
45import com.coder.toolbox.settings.ReadOnlyCoderSettings
56import com.coder.toolbox.settings.ReadOnlyTLSSettings
67import com.coder.toolbox.settings.SignatureFallbackStrategy
@@ -42,6 +43,8 @@ class CoderSettingsStore(
4243 get() = store[DISABLE_SIGNATURE_VALIDATION ]?.toBooleanStrictOrNull() ? : false
4344 override val fallbackOnCoderForSignatures: SignatureFallbackStrategy
4445 get() = SignatureFallbackStrategy .fromValue(store[FALLBACK_ON_CODER_FOR_SIGNATURES ])
46+ override val httpClientLogLevel: HttpLoggingVerbosity
47+ get() = HttpLoggingVerbosity .fromValue(store[HTTP_CLIENT_LOG_LEVEL ])
4548 override val defaultCliBinaryNameByOsAndArch: String get() = getCoderCLIForOS(getOS(), getArch())
4649 override val binaryName: String get() = store[BINARY_NAME ] ? : getCoderCLIForOS(getOS(), getArch())
4750 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"
1414
1515internal const val FALLBACK_ON_CODER_FOR_SIGNATURES = " signatureFallbackStrategy"
1616
17+ internal const val HTTP_CLIENT_LOG_LEVEL = " httpClientLogLevel"
18+
1719internal const val BINARY_NAME = " binaryName"
1820
1921internal const val DATA_DIRECTORY = " dataDirectory"
You can’t perform that action at this time.
0 commit comments