September 2023
Intermediate to advanced
470 pages
11h 12m
English
So far we’ve only considered logging for calls from the HTTP routes to the hub and its responses. But, logging isn’t limited to the HTTP layer or incoming requests. We also need to log other types of external adapters, for example, client to external REST services or messaging systems.
As an example of an outgoing adapter, let’s look at our database adapter. We already used a logger on stdout that was part of the Exposed library, and now we want to replace it with our JsonLogger. We’re lucky, because Exposed has a very nice interface for logging called SqlLogger.
Let’s first add a new operation type, SqlStatement, to our enum:
| | enum class OperationKind { Command, Query, SqlStatement } |
We just need to implement SqlLogger ...
Read now
Unlock full access