GithubHelp home page GithubHelp logo

Comments (5)

darkfrog26 avatar darkfrog26 commented on June 4, 2024

The purpose behind this is to support original types being able to be received by the logging system. For example, if I'm writing a database logger and want to provide a structured logging of specific types I can do so in Scribe. For most people, they always just pass Strings, and in your case, you can use:

import scribe.LogRecord.Stringify._

That will give you implicit conversion support for Throwable. I need to write an update to auto-handle that though.

I appreciate the feedback, and it's a rather new feature that still needs to be iterated upon, but the goal is the capacity to access more than just a String when desired for more complex logging.

from scribe.

cornerman avatar cornerman commented on June 4, 2024

Thanks for the explanation. For me, this sounds like a typeclass would be more suited for this, because I find implicit views kind of dangerous to use. If you have them in scope, you can have funny type conversion just by accident. What do you think?

So defining a Loggable for e.g. Throwable would be much more explicit:

object Loggable {
  implicit object ThrowableLoggable extends Loggable[Throwable] {
     def logString(t: Throwable) = t.getMessage // or whatever
  }
}

So this would even work without an additional import.

from scribe.

darkfrog26 avatar darkfrog26 commented on June 4, 2024

Interested in putting together a PR to represent this? I'm not opposed to the idea, but I'm worried there might be integration issues.

from scribe.

darkfrog26 avatar darkfrog26 commented on June 4, 2024

PR merged, closing.

from scribe.

darkfrog26 avatar darkfrog26 commented on June 4, 2024

Released 2.3.2 with these changes

from scribe.

Related Issues (20)

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.