Logging

Logging is a very important part of any application. It allows you to see what is happening in your application and to debug it. Pillars uses the scribe library for logging.

Configuration

The logging configuration is described in the Configuration section.

Logging in your code

To log something in your code, you can use the logger defined in the pillars package.

def run(using Pillars[IO]): IO[Unit] =
    for
        _ <- logger.info(s"📚 Welcome to ${config.name}!")
        _ <- logger.debug(s"📚 The configuration is: $config")
    yield ()

As the logger is configured before the application starts, you can use it in any part of your code with the classic scribe usage.

import scribe.warn
import scribe.cats.io.info

def foo: IO[Unit] = info("Hello from foo!")

def bar: Unit = warn("Hello from bar!")