Skip to content

Instantly share code, notes, and snippets.

@moradology
Last active December 3, 2015 18:23
Show Gist options
  • Save moradology/9da7fc8a7bd7688ca0fe to your computer and use it in GitHub Desktop.
Save moradology/9da7fc8a7bd7688ca0fe to your computer and use it in GitHub Desktop.
Poor man's log
import java.io._
def printToFile(fileNameString: String)(toWrite: Any) {
val fos = new FileOutputStream(new File(fileNameString), true)
val p = new java.io.PrintWriter(fos)
try { p.append(s"\n$toWrite") } finally { p.close() }
}
printToFile("test.txt")("TEST")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment