Created
August 12, 2014 15:38
-
-
Save MichaelDrogalis/551d1d532e04c1d85ae7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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