object LogMessage {
val DEBUG = "debug"
val INFO = "info"
val WARN = "warn"
val ERROR = "error"
private[protocol] val validLevels = Set(DEBUG, INFO, WARN, ERROR)
}
Instead, it should be implemented by something like:
sealed trait LogMessage
case object Debug extends Message
case object Info extends Message
case object Warn extends Message
case object Error extends Message
This would allow the compiler to provide exhaustive warnings in pattern match expressions.
The current definition of
LogMessage
is:Instead, it should be implemented by something like:
This would allow the compiler to provide exhaustive warnings in pattern match expressions.