Skip to content

Instantly share code, notes, and snippets.

@MichaelDrogalis
Created August 12, 2014 15:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MichaelDrogalis/551d1d532e04c1d85ae7 to your computer and use it in GitHub Desktop.
Save MichaelDrogalis/551d1d532e04c1d85ae7 to your computer and use it in GitHub Desktop.
(ns ^:no-doc onyx.logging-configuration
(:require [com.stuartsierra.component :as component]
[taoensso.timbre :refer [info] :as timbre]))
(defrecord LoggingConfiguration [file config]
component/Lifecycle
(start [component]
(if config
(timbre/set-config! [] config)
(do
(timbre/set-config! [:appenders :standard-out :enabled?] false)
(timbre/set-config! [:appenders :spit :enabled?] true)
(timbre/set-config! [:shared-appender-config :spit-filename] file)))
(info "Starting Logging Configuration")
component)
(stop [component]
(info "Stopping Logging Configuration")
component))
(defn logging-configuration [{:keys [onyx.log/file onyx.log/config]}]
(map->LoggingConfiguration {:file (or file "onyx.log") :config config}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment