mirror of https://github.com/sbt/sbt.git
introduce sbt.log.format for explicit formatting control
implements issue #134 if true, formatting enabled if false, formatting disabled if unset, formatting configured as before sbt.log.noformat is no longer recommended, but is supported: a. setting it to 'true' explicitly disables formatting b. if 'false' or unspecified, autodetection is used c. sbt.log.format takes precedence if defined
This commit is contained in:
parent
8ed0f36dbe
commit
1cd848cd9b
|
|
@ -21,9 +21,13 @@ object ConsoleLogger
|
||||||
def println() = out.println()
|
def println() = out.println()
|
||||||
}
|
}
|
||||||
|
|
||||||
private val formatEnabled = ansiSupported && !formatExplicitlyDisabled
|
val formatEnabled =
|
||||||
|
{
|
||||||
|
import java.lang.Boolean.{getBoolean, parseBoolean}
|
||||||
|
val value = System.getProperty("sbt.log.format")
|
||||||
|
if(value eq null) (ansiSupported && !getBoolean("sbt.log.noformat")) else parseBoolean(value)
|
||||||
|
}
|
||||||
|
|
||||||
private[this] def formatExplicitlyDisabled = java.lang.Boolean.getBoolean("sbt.log.noformat")
|
|
||||||
private[this] def ansiSupported =
|
private[this] def ansiSupported =
|
||||||
try { jline.Terminal.getTerminal.isANSISupported }
|
try { jline.Terminal.getTerminal.isANSISupported }
|
||||||
catch { case e: Exception => !isWindows }
|
catch { case e: Exception => !isWindows }
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue