diff --git a/core/js/src/main/scala/works/iterative/core/Logging.scala b/core/js/src/main/scala/works/iterative/core/Logging.scala deleted file mode 100644 index f836d7f..0000000 --- a/core/js/src/main/scala/works/iterative/core/Logging.scala +++ /dev/null @@ -1,18 +0,0 @@ -package works.iterative.core - -/** Logging app service - * - * This typeclass will be implemented by a JS app to provide logging. - */ -trait Logging[A]: - def log(level: LogLevel, msg: String, t: Option[Throwable]): Unit - def logError(msg: String, t: Throwable): Unit = logError(msg, Some(t)) - def logError(msg: String, t: Option[Throwable]): Unit = - log(LogLevel.Error, msg, t) - def logWarning(msg: String): Unit = log(LogLevel.Warning, msg, None) - def logInfo(msg: String): Unit = log(LogLevel.Info, msg, None) - def logDebug(msg: String): Unit = log(LogLevel.Debug, msg, None) - def logTrace(msg: String): Unit = log(LogLevel.Trace, msg, None) - -enum LogLevel: - case Error, Warning, Info, Debug, Trace diff --git a/core/js/src/main/scala/works/iterative/core/Logging.scala b/core/js/src/main/scala/works/iterative/core/Logging.scala deleted file mode 100644 index f836d7f..0000000 --- a/core/js/src/main/scala/works/iterative/core/Logging.scala +++ /dev/null @@ -1,18 +0,0 @@ -package works.iterative.core - -/** Logging app service - * - * This typeclass will be implemented by a JS app to provide logging. - */ -trait Logging[A]: - def log(level: LogLevel, msg: String, t: Option[Throwable]): Unit - def logError(msg: String, t: Throwable): Unit = logError(msg, Some(t)) - def logError(msg: String, t: Option[Throwable]): Unit = - log(LogLevel.Error, msg, t) - def logWarning(msg: String): Unit = log(LogLevel.Warning, msg, None) - def logInfo(msg: String): Unit = log(LogLevel.Info, msg, None) - def logDebug(msg: String): Unit = log(LogLevel.Debug, msg, None) - def logTrace(msg: String): Unit = log(LogLevel.Trace, msg, None) - -enum LogLevel: - case Error, Warning, Info, Debug, Trace diff --git a/core/shared/src/main/scala/works/iterative/core/UserMessage.scala b/core/shared/src/main/scala/works/iterative/core/UserMessage.scala index 67bf96f..37bda09 100644 --- a/core/shared/src/main/scala/works/iterative/core/UserMessage.scala +++ b/core/shared/src/main/scala/works/iterative/core/UserMessage.scala @@ -4,7 +4,9 @@ // Type-wise naive solution for specifying user messages. // A mechanism that will check the message for correct formatting and validate parameters is needed // TODO: make UserMessage serializable -case class UserMessage(id: MessageId, args: Any*) +case class UserMessage(id: MessageId, args: Any*): + override def toString(): String = + s"${id}[${args.mkString(", ")}]" object UserMessage: given Conversion[MessageId, UserMessage] with diff --git a/core/js/src/main/scala/works/iterative/core/Logging.scala b/core/js/src/main/scala/works/iterative/core/Logging.scala deleted file mode 100644 index f836d7f..0000000 --- a/core/js/src/main/scala/works/iterative/core/Logging.scala +++ /dev/null @@ -1,18 +0,0 @@ -package works.iterative.core - -/** Logging app service - * - * This typeclass will be implemented by a JS app to provide logging. - */ -trait Logging[A]: - def log(level: LogLevel, msg: String, t: Option[Throwable]): Unit - def logError(msg: String, t: Throwable): Unit = logError(msg, Some(t)) - def logError(msg: String, t: Option[Throwable]): Unit = - log(LogLevel.Error, msg, t) - def logWarning(msg: String): Unit = log(LogLevel.Warning, msg, None) - def logInfo(msg: String): Unit = log(LogLevel.Info, msg, None) - def logDebug(msg: String): Unit = log(LogLevel.Debug, msg, None) - def logTrace(msg: String): Unit = log(LogLevel.Trace, msg, None) - -enum LogLevel: - case Error, Warning, Info, Debug, Trace diff --git a/core/shared/src/main/scala/works/iterative/core/UserMessage.scala b/core/shared/src/main/scala/works/iterative/core/UserMessage.scala index 67bf96f..37bda09 100644 --- a/core/shared/src/main/scala/works/iterative/core/UserMessage.scala +++ b/core/shared/src/main/scala/works/iterative/core/UserMessage.scala @@ -4,7 +4,9 @@ // Type-wise naive solution for specifying user messages. // A mechanism that will check the message for correct formatting and validate parameters is needed // TODO: make UserMessage serializable -case class UserMessage(id: MessageId, args: Any*) +case class UserMessage(id: MessageId, args: Any*): + override def toString(): String = + s"${id}[${args.mkString(", ")}]" object UserMessage: given Conversion[MessageId, UserMessage] with diff --git a/ui/shared/src/main/scala/works/iterative/ui/Module.scala b/ui/shared/src/main/scala/works/iterative/ui/Module.scala index 6a44b4a..50bfa56 100644 --- a/ui/shared/src/main/scala/works/iterative/ui/Module.scala +++ b/ui/shared/src/main/scala/works/iterative/ui/Module.scala @@ -7,4 +7,5 @@ def handle(action: Action, model: Model): (Model, Option[Effect]) // Optionally define how to handle failures. // To be used by implementations to allow module to display error messages. - def handleFailure: PartialFunction[Throwable, Option[Action]] + def handleFailure: PartialFunction[Throwable, Option[Action]] = + PartialFunction.empty