Giter VIP home page Giter VIP logo

Comments (3)

rolang avatar rolang commented on May 26, 2024

Hi @colinpilloud ! Right, I guess logging could use a better solution. For now I kept Console[F] because skunk currently also requires a console instance for logging, so you need one anyway. Can't tell at the moment why skunk is not using any logging APIs/frameworks.

You can actually still provide a custom Console[F] instance which can use any logger underneath. I just created a branch with an example module on how you can get the logging via log4cats with slf4j and logback ExampleSlf4jLogback.scala (if you want to try you can checkout the branch and run docker compose up -d && sbt exampleLog4Cats/run). Would that suffice for your use case?

Good thing is that skunk logs will also get formatted using the same logger. One problem with that I guess is that you can't configure the logging for skunk and dumbo separately (e.g. keep dumbo logs, but mute skunk ones).
I am not sure it's worth it to add dependencies on logging frameworks for the few info/debug logs done from the same class in dumbo 🤔. One could maybe create a simple Logger interface like

package dumbo

trait Logger[F[_]] {
  def info(message: String): F[Unit]
  def error(message: String): F[Unit]
  // add more when needed
}

for now and require that along with Console[F] for skunk.
One can then provide this logger instance using any logger underneath for dumbo and a separate console instance for skunk.
I'd rather consider dependency on log4cats if it gets more complex where a LoggerFactory would be useful or skunk is going to add it to the core.

from dumbo.

colinpilloud avatar colinpilloud commented on May 26, 2024

Very useful example and will absolutely suffice for my needs! I thought something like this should be possible but couldn't quite fit the pieces together, so I appreciate you taking the time to put this together.

The Console[F] requirement from skunk is super interesting; I would love to research more about how skunk suggests approaching logging for both libraries and apps and how other developers are doing things!

This probably doesn't need to remain open as an issue; I defer to you on the matter, although either way I appreciate your prompt reply!

from dumbo.

rolang avatar rolang commented on May 26, 2024

@colinpilloud just found that there was a conversation initiated on skunk discord channel about logging: link to message. Sounds like the plan is to use otel4s instead of log4cats.

I'd keep the issue open for now to have a think about it and gather ideas.

from dumbo.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.