First of all, let's see the code for our Logger that we assume that we cannot change:
class Logger { def log(message: String, severity: String): Unit = { System.out.println(s"${severity.toUpperCase}: $message") }}
We've tried to keep it as simple as possible in order to not distract the reader from the main purpose of this book. Next, we could either just write a class that extends Logger or we could provide an interface for abstraction. Let's take the second approach:
trait Log { def info(message: String) def debug(message: String) def warning(message: String) def error(message: String)}
Finally, we can create our AppLogger:
class AppLogger extends Logger with Log { override def info(message: String): Unit = log(message, "info" ...