A micro-library for macro-based case class field masking in .toString
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
project
src
.gitignore
.scalafmt.conf
.travis.yml
LICENSE
README.md
build.sbt
version.sbt

README.md

stringmask

Maven Central License Build Status

A micro-library for macro-based case class field masking in .toString(). Inspired by blog by Juan Pedro Moreno @47deg: http://www.47deg.com/blog/scala-macros-annotate-your-case-classes

Using stringmask

Builds are available for Scala 2.11 and 2.12

libraryDependencies ++= Seq(
  "com.softwaremill.stringmask" %% "stringmask" % "1.3.0",
  compilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full)
)

Example usage:

import com.softwaremill.macros.customize.{customize, mask}
import java.util.Date

@customize
case class User(id: Long, @mask email: String, @mask dob: Date)
val user = User(1, "johndoe@email.com", new Date(1458732695220L))

user.toString

should return User(1,***,***)