-
-
Save siscia/5338109 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 project.logging | |
(:require [clojure.tools.logging :refer [info warn]] | |
[dire.core :refer [with-pre-hook!]] | |
[project.destructure :refer :all])) | |
(with-pre-hook! #'destructure-cow-list | |
(fn [connection] | |
(info connection "is listing cows."))) | |
(with-pre-hook! #'destructure-cow-create | |
(fn [connection message] | |
(info connection "is creating a cow:" message))) | |
(with-pre-hook! #'destructure-chicken-bind | |
(fn [connection message] | |
(info connection "is binding to a chicken:" message))) | |
(with-pre-hook! #'destructure-chicken-unbind | |
(fn [connection] | |
(info connection "is unbinding from a chicken."))) | |
;; It would probably need to be a macro, just to give you an idea of what I was talking about. | |
(def(macro ?) pre-hook-animal [function, message] | |
(with-pre-hook! function | |
(fn [connection] | |
(info connection message)))) | |
;; and then: | |
(pre-hook-animal #'destructure-cow-list "is listing cows.") | |
(pre-hook-animal #'destructure-chicken-unbid "is unbinding from a chicken.") | |
;; and some trick to put inside also the one who use the message. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment