Skip to content

Scala utility to make print line debugging easier

Notifications You must be signed in to change notification settings

h0ngcha0/debug4s

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

debug4s

Debug4s Test Coverage Status License: MIT

Small Scala utility to make print line debugging easier

Setup

Use sbt-github-packages plugin.

And then add the following to your build.sbt file:

resolvers += Resolver.githubPackages("liuhongchao")

libraryDependencies += "it.softfork" %% "debug4s" % "0.1.0"

Features

  • Print file and line number of the debug statement
  • Print the original expression and its type along side the value after it gets evaluated
  • Evaluated value is pretty printed using pprint
  • Support multiple parameters
  • Colorized output

In the following example:

val x = 10
val y = 10
val fooMatrix = List.fill(x)("foo").map(List.fill(y)(_))
debug(fooMatrix, x * y, "i am here to stay")   // This is line 40 in DebugMacroSpec.scala

debug macro will print the following in the console:

Alt text

About

Scala utility to make print line debugging easier

Resources

Stars

Watchers

Forks

Packages

 
 
 

Languages