Back
default-config (clj)
(source)variable
Default/example Timbre `*config*` value:
{:min-level :debug #_[["taoensso.*" :error] ["*" :debug]]
:ns-filter #{"*"} #_{:deny #{"taoensso.*"} :allow #{"*"}}
:middleware [] ; (fns [data]) -> ?data, applied left->right
:timestamp-opts default-timestamp-opts ; {:pattern _ :locale _ :timezone _}
:output-fn default-output-fn ; (fn [data]) -> final output for use by appenders
:appenders
#?(:clj
{:println (println-appender {:stream :auto})
;; :spit (spit-appender {:fname "./timbre-spit.log"})
}
:cljs
(if (exists? js/window)
{:console (console-appender {})}
{:println (println-appender {})}))}
See `*config*` for more info.
Examples
timbre
(ns taoensso.timbre-tests
(:require
[clojure.test :as test :refer [deftest testing is]]
[taoensso.encore :as enc]
[taoensso.timbre :as timbre])
(defmacro log-data
"Executes an easily-configured log call and returns ?data sent to test appender."
[ns level m-config m-appender args]
`(let [appender# (apn ~m-appender)]
(binding [timbre/*config*
(conj timbre/default-config ~m-config
{:appenders {:test-appender appender#}})]
ogri-la/strongbox
(ns strongbox.core-test
(:require
[clojure.string :refer [starts-with? ends-with?]]
[clojure.test :refer [deftest testing is use-fixtures]]
[clj-http.fake :refer [with-global-fake-routes-in-isolation]]
[envvar.core :refer [with-env]]
[me.raynes.fs :as fs]
[taoensso.timbre :as log :refer [debug info warn error spy]]
[java-time :as jt]
[strongbox.cli :as cli]
[strongbox
[addon :as addon :refer [downloaded-addon-fname]]
[logging :as logging]
[zip :as zip]
[main :as main]
[nfo :as nfo]
[catalogue :as catalogue]
[utils :as utils]
[config :as config]
[test-helper :as helper :refer [fixture-path slurp-fixture helper-data-dir with-running-app+opts with-running-app with-running-app*]]
[core :as core]]))
(testing "XDG data paths are ignored if present, but empty"
(with-env [:xdg-data-home "", :xdg-config-home ""]
(let [paths (core/generate-path-map)
expected-config-dir (-> core/default-config-dir utils/expand-path)
expected-data-dir (-> core/default-data-dir utils/expand-path)]
(is (= expected-data-dir (:data-dir paths)))
(is (= expected-config-dir (:config-dir paths)))))))