Skip to content

Commit

Permalink
adjusted how to log AdaptersContextProps.
Browse files Browse the repository at this point in the history
  • Loading branch information
pme123 committed Apr 27, 2018
1 parent 68f3ef2 commit 942b0ed
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion project/Settings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ object Settings {
lazy val orgId = "pme123"
lazy val orgHomepage = Some(new URL("https://github.com/pme123"))
lazy val projectName = "scala-adapters"
lazy val projectV = "1.3.0"
lazy val projectV = "1.3.1"

// main versions
lazy val scalaV = "2.12.4"
Expand Down
14 changes: 2 additions & 12 deletions server/app/pme123/adapters/server/entity/AdaptersContext.scala
Original file line number Diff line number Diff line change
Expand Up @@ -156,22 +156,12 @@ trait AdaptersContextPropsImplicits
def props: Seq[AdaptersContextProp]

lazy val logSettings: Seq[LogEntry] =
props.map(printString)
props.map(_.asString(name))
.map(info(_))

lazy val asString: String = props.map(printString).mkString("\n")

lazy val asHtml: String = "<LI>" + props.map(printString)
.mkString("</LI><LI>") + "</LI>"

protected def pwd(value:String): String = "*" * value.length

private def printString(prop: AdaptersContextProp): String =
propString(prop.key, prop.value)

private def propString(label: String, value: Any) =
s"${name.toUpperCase} '$label' >> $value"

lazy val asString: String = props.map(_.asString(name)).mkString("\n")

implicit def fromAny(bool: Boolean): String = bool.toString

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,15 @@ object AdaptersContextProps {

}

case class AdaptersContextProp(key: String, value: String)
case class AdaptersContextProp(key: String, value: String) {

def asString(name: String): String =
propString(name)

def propString(name: String) =
s"${name.toUpperCase} '$key' >> $value"

}

object AdaptersContextProp {
implicit val jsonFormat: OFormat[AdaptersContextProp] = derived.oformat[AdaptersContextProp]()
Expand Down

0 comments on commit 942b0ed

Please sign in to comment.