Skip to content

Instantly share code, notes, and snippets.

View longshorej's full-sized avatar
🏠
Working from home

Jason Longshore longshorej

🏠
Working from home
View GitHub Profile
@longshorej
longshorej / pretty-print.scala
Created October 28, 2016 18:34 — forked from carymrobbins/pretty-print.scala
Pretty print Scala case classes and other data structures.
import com.typesafe.scalalogging.LazyLogging
object toPrettyString extends LazyLogging {
def apply(a: Any): String = {
try {
/* pretty printing uses reflection which could fail in odd environments, so we default toString in that case */
prettyPrint(a)
} catch {
case t: Throwable =>
logger.error(s"Error calling toPrettyString with: $a", t)