This repository has been archived by the owner on Jun 17, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Let callers decide whether to use (format) in log messages
- Loading branch information
Showing
4 changed files
with
19 additions
and
13 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,28 @@ | ||
;; A set of macros that defer to implementation-specific logging functions. | ||
;; | ||
;; Implementations must provide the `enoki.logging` namespace, and define a | ||
;; logging function within that namespace that looks like: | ||
;; | ||
;; (fn log* [logger-name level eval-msg-fn]) | ||
;; | ||
;; Messages are not evaluated unless the message priority exceeds the relevant | ||
;; logging level. | ||
|
||
(ns enoki.logging-macros) | ||
|
||
(defmacro log | ||
"Delegates logging to function in implementation-defined namespace." | ||
[level msg args] | ||
`(enoki.logging/log* ~(str *ns*) ~level #(format (str ~msg) ~@args))) | ||
[level msg] | ||
`(enoki.logging/log* ~(str *ns*) ~level #(str ~msg))) | ||
|
||
(defmacro debug [msg & args] | ||
`(log :debug ~msg ~args)) | ||
(defmacro debug [msg] | ||
`(log :debug ~msg)) | ||
|
||
(defmacro info [msg & args] | ||
`(log :info ~msg ~args)) | ||
(defmacro info [msg] | ||
`(log :info ~msg)) | ||
|
||
(defmacro warn [msg & args] | ||
`(log :warn ~msg ~args)) | ||
(defmacro warn [msg] | ||
`(log :warn ~msg)) | ||
|
||
(defmacro error [msg & args] | ||
`(log :error ~msg ~args)) | ||
(defmacro error [msg] | ||
`(log :error ~msg)) |
This file contains 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
This file contains 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
This file contains 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