summaryrefslogtreecommitdiff
path: root/core/src/main/scala/mill/util/Logger.scala
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/main/scala/mill/util/Logger.scala')
-rw-r--r--core/src/main/scala/mill/util/Logger.scala29
1 files changed, 29 insertions, 0 deletions
diff --git a/core/src/main/scala/mill/util/Logger.scala b/core/src/main/scala/mill/util/Logger.scala
new file mode 100644
index 00000000..d998a601
--- /dev/null
+++ b/core/src/main/scala/mill/util/Logger.scala
@@ -0,0 +1,29 @@
+package mill.util
+
+import java.io.{OutputStream, PrintStream}
+
+import ammonite.util.Colors
+
+
+trait Logger{
+ val outputStream: PrintStream
+ def info(s: String): Unit
+ def error(s: String): Unit
+}
+
+object DummyLogger extends Logger{
+ val outputStream = new PrintStream(new OutputStream {
+ def write(b: Int) = ()
+ })
+ def info(s: String) = ()
+ def error(s: String) = ()
+}
+class PrintLogger(coloredOutput: Boolean) extends Logger{
+ val outputStream = System.err
+ val colors =
+ if(coloredOutput) Colors.Default
+ else Colors.BlackWhite
+
+ def info(s: String) = System.err.println(colors.info()(s))
+ def error(s: String) = System.err.println(colors.error()(s))
+} \ No newline at end of file