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

By default, 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.

## 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`.
(set! js/console.debug (fn [x] (set! (.-innerHTML (gdom/getElement "my-console")) x)))"🤔"

Logger not switched off

Let's see the reconciler in action - first with 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]
  (render [this]
          (let [{:keys [count]} (om/props this)]
            (dom/div nil
                     (dom/span nil (str "Count: " count))
                     (dom/br nil nil)
                       #js {:onClick
                            (fn [e] (om/transact! this '[(increment)]))}
                       "Click me!")))))

(def 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
    {: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 logger via a url parameter:

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

Happy logging!!!