Coder Social home page Coder Social logo

MDC-like contexts about timbre HOT 8 CLOSED

taoensso avatar taoensso commented on May 18, 2024
MDC-like contexts

from timbre.

Comments (8)

ptaoussanis avatar ptaoussanis commented on May 18, 2024 1

Addressed with 858830a

from timbre.

ptaoussanis avatar ptaoussanis commented on May 18, 2024

Hi Andrew, could you give me some idea of how you'd like to see this implemented (or the kind of API you'd like to see)?

Am juggling quite a few things right now, so the more info you can give me the more likely I'll be able to help out.

Cheers! :-)

from timbre.

prepor avatar prepor commented on May 18, 2024

So. I don't have any interesting ideas about context. Just naive with-context macro with binding inside. It sucks with async code, but in modern world we have core.async with bindings support (as i know).

from timbre.

ptaoussanis avatar ptaoussanis commented on May 18, 2024

Closing for now. Between the log-config support and the relative ease of using custom dynamic bindings without Timbre's assistance, I think we're probably okay here? Feel free to reopen if you disagree. Cheers! :-)

from timbre.

eoliphan avatar eoliphan commented on May 18, 2024

Given that it looks like some of log-config's features are now in timbre itself, would it make sense to have this in timbre now?

Where with-context (or some alternative) merges the map arg with the existing parent value?

from timbre.

ptaoussanis avatar ptaoussanis commented on May 18, 2024

@eoliphan Hi Erich, with-context was added back in 2015: https://github.com/ptaoussanis/timbre/releases/tag/v4.0.0 :-)

from timbre.

eoliphan avatar eoliphan commented on May 18, 2024

Hey yeah, that's what I was referring to :). As it stands, I guess with-context is more like an NDC? The current value is the innermost context. I was looking at more MDC like behavior where the current context is the sum/union of all parents. For example:

(log/with-context
  {:outer :context}
  (log/info "outer")
  (log/with-context
    {:inner :context}
    (log/info "inner")))
; outputs
{... "context":{"outer":"context"} ...}
{... "context":{"inner":"context"} ...}

You'd want the map with both the :inner and :outer keys in the second one.

So basically a variant where the binding statement sets *context* to (merge *context* ~new-context)

from timbre.

ptaoussanis avatar ptaoussanis commented on May 18, 2024

@eoliphan Hi Erich, in that case I think you're probably looking for #262.
There's been a couple requests for that now, so I'll re-open it.

from timbre.

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.