This repository has been archived by the owner on Apr 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Adds the `ktor-client-logging` and `mu-logging-jvm` dependencies. * Adds the `LoggingConfiguration` in the `LoggingConfiguration` - Create the LoggingConfiguration data class. - Create the HttpClientLogLevel enum. - Implements the LoggingConfiguration into the ClientConfiguration. - Rewrite the docs. * Implement in the `Client` the new logger - Add the KLogging() - Set the client logger level - Remove the logger from the EventClient - Replace the `log.` with `logger.` in the EventClient - Add the `.level` property in the KLogger * Implement in the `RequestHandler` the `KLogging()` - Add the KLogging() - Remove the logger from the EventClient
- Loading branch information
1 parent
c5e4a0f
commit a93198d
Showing
9 changed files
with
130 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
clashJ/src/main/kotlin/io/github/maicolantali/types/internal/HttpClientLogLevel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package io.github.maicolantali.types.internal | ||
|
||
import io.ktor.client.plugins.logging.LogLevel | ||
|
||
/** | ||
* Enumeration representing different log levels for an HTTP client. | ||
* | ||
* This enum class defines log levels that can be associated with an HTTP client, | ||
* mapping them to the corresponding log levels in the Ktor HTTP client library. | ||
*/ | ||
enum class HttpClientLogLevel { | ||
/** | ||
* No logging. | ||
*/ | ||
NONE, | ||
|
||
/** | ||
* Log only informational messages for HTTP requests and responses. | ||
*/ | ||
INFO, | ||
|
||
/** | ||
* Log HTTP request and response bodies in addition to informational messages. | ||
*/ | ||
BODY, | ||
|
||
/** | ||
* Log HTTP headers in addition to informational messages. | ||
*/ | ||
HEADERS, | ||
|
||
/** | ||
* Log all details, including HTTP headers and request/response bodies. | ||
*/ | ||
ALL, | ||
|
||
; | ||
|
||
/** | ||
* Converts the enum value to the corresponding Ktor log level. | ||
* | ||
* @return The Ktor log level associated with the enum value. | ||
*/ | ||
internal fun toKtorLogLevel() = | ||
when (this) { | ||
NONE -> LogLevel.NONE | ||
INFO -> LogLevel.INFO | ||
BODY -> LogLevel.BODY | ||
HEADERS -> LogLevel.HEADERS | ||
ALL -> LogLevel.ALL | ||
} | ||
} |
Oops, something went wrong.