[dev.clj]: (with-logging-status) on start

This commit is contained in:
anatoly 2015-11-23 13:28:17 -05:00
parent 357069bef1
commit bbf06c46b1
2 changed files with 8 additions and 15 deletions

View file

@ -1,8 +1,6 @@
(ns dev (ns dev
"Tools for interactive development with the REPL. This file should "Tools for interactive development with the REPL. This file should
not be included in a production build of the application." not be included in a production build of the application."
;; (:use [cljs.repl :only [repl]]
;; [cljs.repl.browser :only [repl-env]])
(:require [clojure.java.io :as io] (:require [clojure.java.io :as io]
[clojure.java.javadoc :refer [javadoc]] [clojure.java.javadoc :refer [javadoc]]
[clojure.pprint :refer [pprint]] [clojure.pprint :refer [pprint]]
@ -11,7 +9,6 @@
[clojure.set :as set] [clojure.set :as set]
[clojure.string :as str] [clojure.string :as str]
[clojure.test :as test] [clojure.test :as test]
;; [clojure.core.async :refer [>!! <!! >! <! go-loop alt! timeout]]
[clojure.tools.namespace.repl :as tn] [clojure.tools.namespace.repl :as tn]
[check.parts-test] [check.parts-test]
[check.start-with-test] [check.start-with-test]
@ -21,6 +18,7 @@
[app :refer [create-nyse-schema find-orders add-order]])) ;; <<<< replace this your "app" namespace(s) you want to be available at REPL time [app :refer [create-nyse-schema find-orders add-order]])) ;; <<<< replace this your "app" namespace(s) you want to be available at REPL time
(defn start [] (defn start []
(with-logging-status)
(mount/start-without #'check.start-with-test/test-conn (mount/start-without #'check.start-with-test/test-conn
#'check.start-with-test/test-nrepl #'check.start-with-test/test-nrepl
#'check.parts-test/should-not-start #'check.parts-test/should-not-start

View file

@ -1,5 +1,6 @@
(ns app.utils.logging (ns app.utils.logging ;; << change to your namespace/path
(:require [robert.hooke :refer [add-hook clear-hooks]] (:require [mount.core]
[robert.hooke :refer [add-hook clear-hooks]]
[clojure.string :refer [split]] [clojure.string :refer [split]]
[clojure.tools.logging :refer [info]])) [clojure.tools.logging :refer [info]]))
@ -37,15 +38,9 @@
#'mount.core/sigstop #'mount.core/sigstop
#'mount.core/sigcont}) #'mount.core/sigcont})
(defn with-logging-status []
(doall (map #(add-hook % log-status) lifecycle-fns)))
(defn without-logging-status [] (defn without-logging-status []
(doall (map #(clear-hooks %) lifecycle-fns))) (doall (map #(clear-hooks %) lifecycle-fns)))
(defn with-logging-status []
;; here is just to illustrate lificycle of states in REPL
;; if needed in reality will be called in "-main" or another entry point
(without-logging-status) (without-logging-status)
(with-logging-status) (doall (map #(add-hook % log-status) lifecycle-fns)))