Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
log
Browse files Browse the repository at this point in the history
darkleaf committed Jan 20, 2025
1 parent 5970136 commit c84de61
Showing 2 changed files with 15 additions and 11 deletions.
10 changes: 6 additions & 4 deletions src/darkleaf/di/core.clj
Original file line number Diff line number Diff line change
@@ -889,9 +889,10 @@
Must be the last one in the middleware chain.
Both callbacks are expected to accept
the following arg `{:keys [key object]}`."
[& {:keys [after-build! after-demolish!]
:or {after-build! (fn no-op [_])
after-demolish! (fn no-op [_])}}]
[& {:keys [after-build! after-demolish!]
#_#_:as opts
:or {after-build! (fn no-op [_])
after-demolish! (fn no-op [_])}}]
(fn [registry]
(fn [key]
(let [factory (registry key)]
@@ -910,7 +911,8 @@
p/FactoryDescription
(description [_]
(assoc (p/description factory)
::will-be-logged true)))))))
::log {:will-be-logged true
#_#_:opts opts})))))))

(defn- inspect-middleware []
(fn [registry]
16 changes: 9 additions & 7 deletions test/darkleaf/di/tutorial/x_inspect_test.clj
Original file line number Diff line number Diff line change
@@ -282,14 +282,16 @@
(t/deftest log-test
(t/is (= [{:key ::di/implicit-root
:dependencies {`foo :required}
:description {::di/kind :ref
:key `foo
:type :required
::di/will-be-logged true}}
:description {::di/kind :ref
:key `foo
:type :required
::di/log {:will-be-logged true
#_#_:opts nil}}}
{:key `foo
:description {::di/kind :trivial
:object :obj
::di/will-be-logged true}}]
:description {::di/kind :trivial
:object :obj
::di/log {:will-be-logged true
#_#_:opts nil}}}]
(di/inspect `foo
{`foo :obj}
(di/log)))))

0 comments on commit c84de61

Please sign in to comment.