Created
March 7, 2025 16:04
-
-
Save thomascothran/c6580d503fdc98ca2a4cf99cd83447cf to your computer and use it in GitHub Desktop.
Mulog tap publisher
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {:paths ["."]} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; --------------------------------------------------------- | |
| ;; Mulog Custom Publishers | |
| ;; - tap publisher for use with Portal and other tap sources | |
| ;; h/t Practicalli - https://practical.li/clojure/data-inspector/portal/#tap-logs-to-portal | |
| ;; --------------------------------------------------------- | |
| (ns tap-publisher | |
| (:require | |
| [com.brunobonacci.mulog.buffer :as mulog-buffer] | |
| [portal.api :as p])) | |
| (deftype TapPublisher [buffer transform] | |
| com.brunobonacci.mulog.publisher.PPublisher | |
| (agent-buffer [_] buffer) | |
| (publish-delay [_] 200) | |
| (publish [_ buffer] | |
| (doseq [item (transform (map second (mulog-buffer/items buffer)))] | |
| (tap> item)) | |
| (mulog-buffer/clear buffer))) | |
| (defn tap | |
| [{:keys [transform] :as _config}] | |
| (TapPublisher. (mulog-buffer/agent-buffer 10000) (or transform identity))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment