Skip to content

Commit

Permalink
Update to latest ZIO release candidate
Browse files Browse the repository at this point in the history
Remove console - no longer compatible, under the current design of the library.
However, logback's default console logger can still be used.
  • Loading branch information
greenrd authored and NeQuissimus committed Apr 23, 2019
1 parent eb35ce9 commit e7cc250
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 36 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ libraryDependencies ++= Seq(
"com.lihaoyi" %% "sourcecode" % "0.1.5",
"com.lihaoyi" %% "utest" % "0.6.6" % Test,
"org.scalaz" %% "scalaz-core" % "7.2.27",
"org.scalaz" %% "scalaz-zio" % "0.6.3",
"org.scalaz" %% "scalaz-zio" % "1.0-RC4",
"org.slf4j" % "slf4j-api" % "1.7.26",
compilerPlugin("com.github.ghik" %% "silencer-plugin" % "1.3.2"),
"com.github.ghik" %% "silencer-lib" % "1.3.2" % Provided
Expand Down
17 changes: 0 additions & 17 deletions src/main/scala/console.scala

This file was deleted.

10 changes: 5 additions & 5 deletions src/main/scala/logger.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import scalaz.Show
import scalaz.zio.IO

trait Logger {
def trace[A: Show](a: A): IO[Throwable, Unit]
def debug[A: Show](a: A): IO[Throwable, Unit]
def info[A: Show](a: A): IO[Throwable, Unit]
def warn[A: Show](a: A): IO[Throwable, Unit]
def error[A: Show](a: A): IO[Throwable, Unit]
def trace[A: Show](a: A): IO[Nothing, Unit]
def debug[A: Show](a: A): IO[Nothing, Unit]
def info[A: Show](a: A): IO[Nothing, Unit]
def warn[A: Show](a: A): IO[Nothing, Unit]
def error[A: Show](a: A): IO[Nothing, Unit]
}
16 changes: 8 additions & 8 deletions src/main/scala/queue.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ trait QueueLogger {
val queue = new ArrayDeque[(Level, String)]

implicit lazy val logger: Logger = new Logger {
def trace[A](a: A)(implicit S: Show[A]): IO[Throwable, Unit] =
IO.syncThrowable(queue.offer((Trace, S.shows(a)))).void
def debug[A](a: A)(implicit S: Show[A]): IO[Throwable, Unit] =
IO.syncThrowable(queue.offer((Debug, S.shows(a)))).void
def info[A](a: A)(implicit S: Show[A]): IO[Throwable, Unit] = IO.syncThrowable(queue.offer((Info, S.shows(a)))).void
def warn[A](a: A)(implicit S: Show[A]): IO[Throwable, Unit] = IO.syncThrowable(queue.offer((Warn, S.shows(a)))).void
def error[A](a: A)(implicit S: Show[A]): IO[Throwable, Unit] =
IO.syncThrowable(queue.offer((Error, S.shows(a)))).void
def trace[A](a: A)(implicit S: Show[A]): IO[Nothing, Unit] =
IO.effectTotal(queue.offer((Trace, S.shows(a)))).unit
def debug[A](a: A)(implicit S: Show[A]): IO[Nothing, Unit] =
IO.effectTotal(queue.offer((Debug, S.shows(a)))).unit
def info[A](a: A)(implicit S: Show[A]): IO[Nothing, Unit] = IO.effectTotal(queue.offer((Info, S.shows(a)))).unit
def warn[A](a: A)(implicit S: Show[A]): IO[Nothing, Unit] = IO.effectTotal(queue.offer((Warn, S.shows(a)))).unit
def error[A](a: A)(implicit S: Show[A]): IO[Nothing, Unit] =
IO.effectTotal(queue.offer((Error, S.shows(a)))).unit
}
}
10 changes: 5 additions & 5 deletions src/main/scala/slf4j.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ trait Slf4jLogger {
implicit lazy val logger: Logger with InnerLogger[slf4j.Logger] = new Logger with InnerLogger[slf4j.Logger] {
val inner: slf4j.Logger = slf4j.LoggerFactory.getLogger(clazzName)

def trace[A](a: A)(implicit S: Show[A]): IO[Throwable, Unit] = IO.syncThrowable(inner.trace(S.shows(a)))
def debug[A](a: A)(implicit S: Show[A]): IO[Throwable, Unit] = IO.syncThrowable(inner.debug(S.shows(a)))
def info[A](a: A)(implicit S: Show[A]): IO[Throwable, Unit] = IO.syncThrowable(inner.info(S.shows(a)))
def warn[A](a: A)(implicit S: Show[A]): IO[Throwable, Unit] = IO.syncThrowable(inner.warn(S.shows(a)))
def error[A](a: A)(implicit S: Show[A]): IO[Throwable, Unit] = IO.syncThrowable(inner.error(S.shows(a)))
def trace[A](a: A)(implicit S: Show[A]): IO[Nothing, Unit] = IO.effectTotal(inner.trace(S.shows(a)))
def debug[A](a: A)(implicit S: Show[A]): IO[Nothing, Unit] = IO.effectTotal(inner.debug(S.shows(a)))
def info[A](a: A)(implicit S: Show[A]): IO[Nothing, Unit] = IO.effectTotal(inner.info(S.shows(a)))
def warn[A](a: A)(implicit S: Show[A]): IO[Nothing, Unit] = IO.effectTotal(inner.warn(S.shows(a)))
def error[A](a: A)(implicit S: Show[A]): IO[Nothing, Unit] = IO.effectTotal(inner.error(S.shows(a)))
}
}

0 comments on commit e7cc250

Please sign in to comment.