From be9ee3bb9f101710198df3fe5dd4e5e84c9ce2af Mon Sep 17 00:00:00 2001 From: awb99 Date: Tue, 26 Nov 2024 00:34:49 -0500 Subject: [PATCH] better service logging --- spa/src/webly/spa/service.cljs | 17 ++++++++++++----- webly/src/webly/module/build.cljs | 10 +++++----- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/spa/src/webly/spa/service.cljs b/spa/src/webly/spa/service.cljs index 74207cf..1018f3c 100644 --- a/spa/src/webly/spa/service.cljs +++ b/spa/src/webly/spa/service.cljs @@ -7,17 +7,24 @@ (defn start-cljs-service [resolver {:keys [name config start-fn]}] (let [r-p (p/deferred) start-p (resolver start-fn)] - (warn "starting cljs-service name: " name "start-fn: " start-fn) + (info "starting cljs-service name: " name "start-fn: " start-fn) (-> start-p (p/then (fn [start] (let [r (start config)] (if (p/promise? r) (-> r - (p/then (fn [_] (p/resolve! r-p nil))) + (p/then (fn [_] + (info "clj-service name: " name " successfully started!") + (p/resolve! r-p nil))) (p/catch (fn [err] - (error "error in starting service: " start-fn " err: " err))) - r) - (p/resolve! r-p nil)))))) + (error "clj-service name: " name "cannot be started. start-fn: " start-fn " error: " err) + (p/reject! r-p nil)))) + (do + (info "clj-service name: " name " successfully started!") + (p/resolve! r-p nil)))))) + (p/catch (fn [err] + (error "could not resolve service: " start-fn " error: " err) + (p/reject! r-p nil)))) r-p)) (defn start-cljs-services [services] diff --git a/webly/src/webly/module/build.cljs b/webly/src/webly/module/build.cljs index e753028..6f7047a 100644 --- a/webly/src/webly/module/build.cljs +++ b/webly/src/webly/module/build.cljs @@ -70,10 +70,10 @@ (let [loadable (get @lazy-ns-loadable-a ns-name) rp (p/deferred) on-error (fn [err] - (println "could not load ns: " ns-name " ERROR: " err) + ;(println "could not load ns: " ns-name " ERROR: " err) (p/reject! rp err)) on-success (fn [vars] - (println "ns [" ns-name "] loaded successfully!") + ;(println "ns [" ns-name "] loaded successfully!") (p/resolve! rp vars))] ; lazy/load does return a google deferred, so we cannot use promises here. (try @@ -106,7 +106,7 @@ (let [rp2 (load-namespace-raw ns-name)] (-> rp2 (p/then (fn [vars] - (println "load-namespace vars successfully received!") + ;(println "load-namespace vars successfully received!") (p/resolve! rp (assemble-simple-ns ns-name vars)))))) (do (println "cannot load-namespace [" (pr-str ns-name) "] - not a simple-namespace!") (p/reject! rp (str "cannot load-namespace: " @@ -122,8 +122,8 @@ (-> ns-rp (p/then (fn [ns-map] (if-let [fun (get ns-map fn-symbol)] - (do (println "resolved successfully: " fq-symbol) - (p/resolve! rp fun)) + (do ;(println "resolved successfully: " fq-symbol) + (p/resolve! rp fun)) (do (println "could not resolve: " fq-symbol) (p/reject! rp (str "namespace does not contain function: " fn-symbol)))))) (p/catch (fn [err]