Last active
April 27, 2021 20:23
-
-
Save borkdude/c97da85da67c7bcc5671765aef5a89ad to your computer and use it in GitHub Desktop.
Simple logger that works in bb
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
(ns logger) | |
(defmacro log [& msgs] | |
(let [m (meta &form) | |
_ns (ns-name *ns*) ;; can also be used for logging | |
file *file*] | |
`(binding [*out* *err*] ;; or bind to (io/writer log-file) | |
(println (str ~file ":" | |
~(:line m) ":" | |
~(:column m)) | |
~@msgs)))) | |
(ns bar (:require logger)) | |
(logger/log "what goes on here") | |
;; <snip>/logger.clj:15:1 what goes on here |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment