diff --git a/distage/distage-framework/src/main/scala/izumi/distage/roles/logger/SimpleLoggerConfigurator.scala b/distage/distage-framework/src/main/scala/izumi/distage/roles/logger/SimpleLoggerConfigurator.scala index bd04a4391a..2369ca1aa6 100644 --- a/distage/distage-framework/src/main/scala/izumi/distage/roles/logger/SimpleLoggerConfigurator.scala +++ b/distage/distage-framework/src/main/scala/izumi/distage/roles/logger/SimpleLoggerConfigurator.scala @@ -1,7 +1,7 @@ package izumi.distage.roles.logger import com.typesafe.config.Config -import io.circe.Decoder +import io.circe.{Decoder, Json} import izumi.distage.config.codec.{CirceDerivationConfigStyle, ConfigReader} import izumi.distage.roles.logger.SimpleLoggerConfigurator.SinksConfig import izumi.logstage.api.config.{LoggerConfig, LoggerPathConfig} @@ -70,7 +70,23 @@ object SimpleLoggerConfigurator { layout: Option[String], ) object SinksConfig { - implicit val decoder: Decoder[SinksConfig] = CirceDerivationConfigStyle.deriveDecoder + implicit val decoder: Decoder[SinksConfig] = for { + levels <- Decoder.forProduct1("levels")(identity[Map[String, List[String]]]) + options <- Decoder.forProduct1("options")(identity[Option[RenderingOptions]]) + json <- Decoder.forProduct1("json")((_: Json).fold( + jsonNull = None, + jsonBoolean = Some(_), + jsonNumber = _ => None, + jsonString = { str => + if (Set("true", "on").contains(str)) Some(true) + else if (Set("false", "off").contains(str)) Some(false) + else None + }, + jsonArray = _ => None, + jsonObject = _ => None, + )) + layout <- Decoder.forProduct1("layout")(identity[Option[String]]) + } yield SinksConfig(levels, options, json, layout) implicit val configReader: ConfigReader[SinksConfig] = ConfigReader.deriveFromCirce } }