diff --git a/src/taoensso/timbre.clj b/src/taoensso/timbre.clj index 17b483b..f28b13b 100644 --- a/src/taoensso/timbre.clj +++ b/src/taoensso/timbre.clj @@ -132,10 +132,18 @@ (defn- wrap-appender-fn "Wraps compile-time appender fn with additional runtime capabilities controlled by compile-time config." - [{apfn :fn :keys [async? max-message-per-msecs] :as appender}] + [{apfn :fn :keys [async? max-message-per-msecs prefix-fn] :as appender}] (->> ; Wrapping applies capabilities bottom-to-top apfn + ;; Wrap for per-appender prefix-fn support + ((fn [apfn] + (if-not prefix-fn + apfn + (fn [apfn-args] + (apfn (assoc apfn-args + :prefix (prefix-fn apfn-args))))))) + ;; Wrap for runtime flood-safety support ((fn [apfn] (if-not max-message-per-msecs @@ -407,4 +415,4 @@ (if (contains? message :password) (assoc args :message (assoc message :password "*****")) args) - :else args))])) \ No newline at end of file + :else args))])) diff --git a/src/taoensso/timbre/appenders/irc.clj b/src/taoensso/timbre/appenders/irc.clj index a50b704..873952b 100644 --- a/src/taoensso/timbre/appenders/irc.clj +++ b/src/taoensso/timbre/appenders/irc.clj @@ -32,9 +32,7 @@ (when-let [irc-config (:irc ap-config)] (send-message (assoc irc-config - :prefix (if-let [prefix-fn (:prefix-fn irc-config)] - (prefix-fn prefix) - prefix) + :prefix prefix :message message)))) (def irc-appender @@ -44,4 +42,5 @@ :name \"My Logger\" :chan \"#logs\"") :min-level :info :enabled? true :async? false :max-message-per-msecs nil ; no rate limit by default + :prefix-fn (fn [{:keys [level]}] (-> level name str/upper-case)) :fn appender-fn})