Library for Scala 2.13+ projects for pretty printing case classes with field names in hierarchical tree format. Useful for debugging purposes as it gives human readable representation of case classes. Provides
.spy extension method for any object.
Works only with Scala 2.13+
libraryDependencies += "com.gu" %% "spy" % "x.x.x"
import com.gu.spy._ case class Address(street: String, city: String, planet: String, country: String) case class User(name: String, age: Int, address: Address) val user = User("Jean-Luc Picard", 79, Address("Starfleet", "San Francisco", "Earth", "United Federation of Planets")) println(user.spy)
User name: Jean-Luc Picard age: 79 address: Address street: Starfleet city: San Francisco planet: Earth country: United Federation of Planets
as opposed to usual
User(Jean-Luc Picard,79,Address(Starfleet,San Francisco,Earth,United Federation of Planets))