This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-08-22
Channels
- # aws (12)
- # babashka (24)
- # beginners (51)
- # biff (2)
- # cherry (4)
- # cider (2)
- # clj-kondo (4)
- # cljs-dev (19)
- # clojure (70)
- # clojure-australia (4)
- # clojure-europe (39)
- # clojure-nl (4)
- # clojure-norway (6)
- # clojure-spec (9)
- # clojurescript (21)
- # component (6)
- # cursive (18)
- # data-science (9)
- # datomic (18)
- # events (2)
- # expound (4)
- # fulcro (15)
- # graalvm (2)
- # graphql (5)
- # jobs (1)
- # juxt (2)
- # leiningen (8)
- # malli (4)
- # meander (21)
- # nrepl (3)
- # observability (14)
- # off-topic (49)
- # other-languages (1)
- # pathom (13)
- # pedestal (7)
- # rdf (5)
- # re-frame (10)
- # reitit (1)
- # sql (4)
- # squint (30)
- # tools-deps (1)
- # vim (11)
@bruno.bonacci Don't know if this is something that would interest you, but i've taken a very https://www.youtube.com/watch?v=WhwqBUCYQO0 approach and am attempting to rip off mulog https://github.com/bowbahdoe/log
That's great, I was thinking to add a Java client as well. I'm just so short with the time at the moment. Let me know how you are proceeding with it and if you are facing any challenges.
And i'm punting on the ring buffer stuff since idk how to implement that without a dependency
the disruptor is a nice project, be careful about what you add in your core project as the more you add the more possibility of version conflict with other (direct or transitive) dependencies. The nice thing about the persistent/immutable ring-buffer I use is that being immutable it removes a ton of possible concurrency issues. The disruptor is designed for concurrent use as well, but you have to follow its model very closely.
The only thing (I think) stopping this from being able to be used as a frontend to mulog is the context system
private static final AtomicReference<ThreadLocal<Context>> CONTEXT_REFERENCE =
new AtomicReference<>(ThreadLocal.withInitial(() -> Context.Global.EMPTY));
public sealed interface Context {
record Global(List<Log.Entry> entries) implements Context {
static final Global EMPTY = new Global(List.of());
}
record Child(
@Design(Design.Choice.EVERY_CHILD_CONTEXT_ELEMENT_HAS_ITS_OWN_REFERENCE_TO_A_THREAD)
Thread thread,
Instant timestamp,
Flake flake,
List<Log.Entry> entries,
Context parent
) implements Context {
}
}
which isn't too dissimilar from mulog's approach
(defonce ^{:doc "The global logging context is used to add properties
which are valid for all subsequent log events. This is
typically set once at the beginning of the process with
information like the app-name, version, environment, the
pid and other similar info."}
global-context (atom {}))
(def ^{:doc "The local context is local to the current thread,
therefore all the subsequent call to log withing the
given context will have the properties added as well. It
is typically used to add information regarding the
current processing in the current thread. For example
who is the user issuing the request and so on."}
local-context (ut/thread-local nil))