All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.specs2.io.Output.scala Maven / Gradle / Ivy

There is a newer version: 3.7
Show newest version
package org.specs2
package io

/**
 * This trait represents an output with standard print functions
 */
trait Output {
  /**
   * print several objects according to a format string (see Console.printf)
   */
  def printf(format: String, args: Any*)
  /**
   * print an object with a newline
   */
  def println(m: Any) = printf("%s\n", m)
  /**
   * print an object with no newline
   */
  def print(m: Any) = this.printf("%s", m)
  /**
   * flush the content if necessary
   */
  def flush() = {}
  /**
   * print stacktraces
   */
  def printStackTrace(t: Throwable) = t.printStackTrace(new java.io.PrintWriter(System.err) {
    override def println(s: String) = Output.this.println(s)
  })
}

object Output {
  val NoOutput = new Output {
    def printf(format: String, args: Any*) {}
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy