It helps to add logging capability to components allowing them to use a LogWriter[F]
if in
scope or defaulting, when F[_] is an Applicative, to noOpLog[F] if no LogWriter
is provided.
Example:
def create[F[_]: LogSelector](a: String): ALoggingClient[F] = new ALoggingClient[F] { def do = LogSelector[F].writer.info("something") }
def useTheClient[F[_]](address: String): F[Unit] = { implicit val logger: LogWriter[F] =
consoleLog[F] createF } will log using logger
def useTheClient[F[_]](address: String): F[Unit] = createF will not log
- Companion:
- object
class AnyVal
trait Matchable
class Any