Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: refactor: logging #403

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

WIP: refactor: logging #403

wants to merge 1 commit into from

Conversation

saku-koodari
Copy link
Contributor

@saku-koodari saku-koodari commented Nov 13, 2024

refactor logging more. Waiting for #365

Muutokset: lisätty endpoint addResponse metodiin.

esim:

// How to use
logger.atInfo().addResponse(PeerService.Oppijanumero, "yleistunniste.hae", authenticatedResponse).log()

Ja se on nyt jotakuinkin näin:

// Implementations
inline fun <reified T> LoggingEventBuilder.addResponse(
    peerService: PeerService,
    endpoint: String,
    response: HttpResponse<T>,
): LoggingEventBuilder = addResponse<T>(peerService, endpoint, response.headers(), response.body())


inline fun <reified T> LoggingEventBuilder.addResponse(
    peerService: PeerService,
    endpoint: String,
    responseHeaders: Any,
    responseBody: Any?,
): LoggingEventBuilder =
    this
        .addKeyValue("$peerService.$endpoint.response.headers", responseHeaders)
        .addKeyValue("$peerService.$endpoint.response.body", responseBody)
        .addKeyValue("peer.service", peerService.value)

@saku-koodari saku-koodari requested a review from a team as a code owner November 13, 2024 10:16
@saku-koodari saku-koodari marked this pull request as draft November 13, 2024 14:44
@saku-koodari saku-koodari self-assigned this Nov 13, 2024
@saku-koodari saku-koodari changed the title refactor: logging WIP: refactor: logging Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant