I'd like to use a sticker to show me https://github.com/fulcrologic/guardrails log errors. They look like this and come up during runtime:
user=> (f 3.2)
ERROR /Users/user/project/src/com/domain/app_ns.clj:12 f's argument list
-- Spec failed --------------------
[3.2]
^^^
should satisfy
int?
or
string?
-- Relevant specs -------
:user/thing:
(clojure.spec.alpha/or :i clojure.core/int? :s clojure.core/string?)
This https://github.com/fulcrologic/guardrails/blob/920a372e86063a255b5036b4d07303f87024bb9e/src/main/com/fulcrologic/guardrails/core.cljc#L87 is responsible for handling errors and ultimately delegates error printing to utils/report-problem, which just calls (.println message-str).
I can't quite figure out how to set up the sticker. I understand that stickers are typically applied to ref types, but is it possible to use with a simple function as a sort of watch? Any tips?It seems there is an option for using tap>
And reveal has built in tap-sticker
Maybe that's enough?
Yes, there is, but I much prefer the string representation show above over the usual Spec error description in data. The tap would be good enough, but I am curious if I can use Reveal to keep an eye out on some formatted string output. As an aside, I'm a new Reveal user. Liking it very much so far. Thanks for the awesome tool!
Hmm, this library prints to System/err...
You'll need to override that...
Ah, just to a simple println instead of the interop call with System/err. Okay, this should suffice. Thank you.