From c70e7f38760f8594e384dd48879995794cf01528 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Thu, 25 Sep 2025 09:57:56 +0200 Subject: [PATCH] :sparkles: Add logging to frontend repo namespace --- frontend/src/app/main/repo.cljs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/main/repo.cljs b/frontend/src/app/main/repo.cljs index d863465b42..7294f823cf 100644 --- a/frontend/src/app/main/repo.cljs +++ b/frontend/src/app/main/repo.cljs @@ -8,6 +8,8 @@ (:require [app.common.data :as d] [app.common.exceptions :as ex] + [app.common.logging :as log] + [app.common.time :as ct] [app.common.transit :as t] [app.common.uri :as u] [app.config :as cf] @@ -17,6 +19,8 @@ [beicon.v2.core :as rx] [cuerdas.core :as str])) +(log/set-level! :info) + (defn handle-response [{:keys [status body headers uri] :as response}] (cond @@ -126,13 +130,21 @@ (select-keys params query-params) nil)) :response-type - (if stream? nil response-type)}] + (if stream? nil response-type)} + + tpoint + (ct/tpoint-ms)] + + (log/trc :hint "make request" :id id) (->> (http/fetch request) (rx/map http/response->map) (rx/mapcat (fn [{:keys [headers body] :as response}] + (log/trc :hint "response received" :id id :elapsed (tpoint)) + (let [ctype (get headers "content-type") - response-stream? (str/starts-with? ctype "text/event-stream")] + response-stream? (str/starts-with? ctype "text/event-stream") + tpoint (ct/tpoint-ms)] (when (and response-stream? (not stream?)) (ex/raise :type :internal @@ -148,6 +160,8 @@ (->> response (http/process-response-type response-type) (rx/map decode-fn) + (rx/tap (fn [_] + (log/trc :hint "response decoded" :id id :elapsed (tpoint)))) (rx/mapcat handle-response))))))))) (defmulti cmd! (fn [id _] id))