Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unused warnings in logging #787

Merged
merged 3 commits into from
Sep 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package tofu.logging.zlogs
import tofu.logging.impl.{ZUniversalContextLogging, ZUniversalLogging}
import tofu.logging.{Loggable, Logging}
import zio._
import scala.annotation.unused

object ZLogging {
type ZMake[R] = Logging.Make[URIO[R, *]]
Expand All @@ -20,7 +21,7 @@ object ZLogging {
* @tparam R
* the context, an environment of the logging methods.
*/
def layerContextual[R: Loggable: Tag]: ULayer[Has[ZLogging.ZMake[R]]] = ZLayer.succeed(
def layerContextual[R: Loggable](implicit @unused RT: Tag[R]): ULayer[Has[ZLogging.ZMake[R]]] = ZLayer.succeed(
new ZUniversalContextLogging(_, ZIO.environment[R])
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import zio.console.Console
import zio._

import scala.jdk.CollectionConverters._
import scala.annotation.nowarn

class ZLogsSuite extends AnyFlatSpec with Matchers {

Expand Down Expand Up @@ -53,6 +54,7 @@ class ZLogsSuite extends AnyFlatSpec with Matchers {
val logLayer: URLayer[Has[CtxService], Has[ZLogging.Make]] =
ZLogging.Make.layerPlainWithContext(_.get)

@nowarn("cat=unused-locals")
val program = for {
logs <- ZIO.service[ZLogging.Make]
implicit0(logger: ULogging) = logs.byName(Name)
Expand Down