Skip to content

Commit b1d1e3d

Browse files
committed
Allow to log error message without exception in BloopRifleLogger
1 parent 864e1a5 commit b1d1e3d

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

modules/bloop-rifle/src/main/scala/scala/build/blooprifle/BloopRifleLogger.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ trait BloopRifleLogger { self =>
99
def debug(msg: => String, ex: Throwable): Unit
1010
final def debug(msg: => String): Unit = debug(msg, null)
1111
def error(msg: => String, ex: Throwable): Unit
12+
def error(msg: => String): Unit
1213
def runnable(name: String)(r: Runnable): Runnable = { () =>
1314
try r.run()
1415
catch {
@@ -39,6 +40,7 @@ object BloopRifleLogger {
3940
def info(msg: => String) = {}
4041
def debug(msg: => String, ex: Throwable) = {}
4142
def error(msg: => String, ex: Throwable) = {}
43+
def error(msg: => String) = {}
4244
def bloopBspStdout = None
4345
def bloopBspStderr = None
4446
def bloopCliInheritStdout = false

modules/build/src/test/scala/scala/build/tests/TestLogger.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ case class TestLogger(info: Boolean = true, debug: Boolean = false) extends Logg
6060
System.err.println(msg)
6161
if (ex != null) ex.printStackTrace(System.err)
6262
}
63+
def error(msg: => String): Unit = System.err.println(msg)
6364
def info(msg: => String): Unit =
6465
System.err.println(msg)
6566
}

modules/cli/src/main/scala/scala/cli/internal/CliLogger.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,11 @@ class CliLogger(
164164
ex.printStackTrace(out)
165165
}
166166
def error(msg: => String, ex: Throwable) = {
167-
logger.log(s"Error: $msg ($ex)")
167+
logger.error(s"Error: $msg ($ex)")
168168
if (verbosity >= 1 && ex != null)
169169
ex.printStackTrace(out)
170170
}
171+
def error(msg: => String) = logger.error(msg)
171172
def bloopBspStdout =
172173
if (verbosity >= 2) Some(out)
173174
else None

0 commit comments

Comments
 (0)