Open road21 opened 1 year ago
This pull request provides basic support for derivation LogstageCodec from izumi.logstage library.
LogstageCodec
izumi.logstage
Quick example:
@SnakeCase @Discriminator("type") enum User derives Config, EvoLog: case AuthorizedClient(@Rename("client_id") id: Long, name: String, @Masked token: String) case Anonymous import logstage.IzLogger val logger = IzLogger() val user = User.AuthorizedClient(100, "Bob", "123") import evo.derivation.logstage.instances.given // arggh logger.trace(s"User: $user")
Will print:
T 2023-06-08T18:45:34.795 (LogstageTest.scala:27) …ation.logstage.LogstageTest [1:main] User: user={type: authorized_client; client_id: 100; name: Bob; token: ***masked***}
The problem is that LogstageCodec is contravariant, so EvoLog doesn't extend LogstageCodec, and that's why import evo.derivation.logstage.instances.given here.
EvoLog
import evo.derivation.logstage.instances.given
This pull request provides basic support for derivation
LogstageCodec
fromizumi.logstage
library.Quick example:
Will print:
The problem is that
LogstageCodec
is contravariant, soEvoLog
doesn't extendLogstageCodec
, and that's whyimport evo.derivation.logstage.instances.given
here.