Om.Next is a uniform yet extensible approach to building networked interactive applications. (Check this interactive tutorial to learn more about om.next .)

(ns om-tutorial.part (:require goog.debug.formatter goog.debug.RelativeTimeProvider [goog.dom :as gdom] [om.next :as om :refer-macros [defui]] [om.dom :as dom]))

By default, om.next logs every transaction (calling console.debug ). Usually it is very helpful. But sometimes you want to switch off the logging.

You can switch off the logging through the compiler options by setting :closure-defines {goog.DEBUG false} (Thanks for the tip António N. Monteiro).

But you can also do it at run-time through the :logger parameter when creating your reconciler.

(set! js/console.debug (fn [x] (set! (.-innerHTML (gdom/getElement "my-console")) x)))"🤔"

Logger not switched off

## Redirecting the browser console In order to save you the effort of opening the browser console, we are going to monkey patch `console.debug` and redirect its output to a `div#my-console`.

Let's see the reconciler in action - first with om.next logger not switched off.

(defn read [{:keys [state] :as env} key params] (let [st @state] (if-let [[_ value] (find st key)] {:value value} {:value :not-found}))) (defn mutate [{:keys [state] :as env} key params] (if (= 'increment key) {:value {:keys [:count]} :action #(swap! state update-in [:count] inc)} {:value :not-found})) (defui Counter static om/IQuery (query [this] [:count]) Object (render [this] (let [{:keys [count]} (om/props this)] (dom/div nil (dom/span nil (str "Count: " count)) (dom/br nil nil) (dom/button #js {:onClick (fn [e] (om/transact! this '[(increment)]))} "Click me!"))))) (def reconciler (om/reconciler {:state (atom {:count 0}) :parser (om/parser {:read read :mutate mutate})})) (om/add-root! reconciler Counter js/klipse-container)

As you can check by yourself, each time you click on the button a transaction is logged in our console.

Nothing in the console for the moment... 🤗

## Logger switched off

And now, using a reconciler without logging:

(def reconciler-no-logging (om/reconciler {:logger nil :state (atom {:count 0}) :parser (om/parser {:read read :mutate mutate})})) (om/add-root! reconciler-no-logging Counter js/klipse-container)

As you can check by yourself, you click on the button and no transaction is logged in our console.

I'm using this tip inside the klipse app where you can switch on and off om.next logger via a url parameter:

By default, logger is disabled

http://app.klipse.tech/?logger=true => logger enabled

http://app.klipse.tech/?logger=false => logger disabled

I have updated the om.next documentation with all the currently available options in the reconciler function.

Happy logging!!!