You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.adoc
+25-5
Original file line number
Diff line number
Diff line change
@@ -97,6 +97,15 @@ You can control if spec failures are advisory or fatal by editing `guardrails.ed
97
97
98
98
Make sure to set your editor or IDE to resolve Guardrails' `>defn` and `>fdef` as Clojure's `defn`, and `>defn-` as `defn-` respectively – this way you get proper highlighting, formatting, error handling, structural navigation, symbol resolution, and refactoring support. A linting configuration for clj-kondo is included and should work out of the box.
99
99
100
+
=== Output Options
101
+
102
+
The configuration can be changed to help the signal to noise ratio on failures. If you have heavily instrumented your code with Guardrails, then turning on these two config options will likely give you a clearer picture on failures:
103
+
104
+
* `:guardrails/compact? true` - Remove blank/excess lines from the failure output.
105
+
* `:guardrails/stack-trace :none` - Change what is shown for the stack trace. :none elides it, :prune causes a more pruned stack trace on a single line, and :full is the default of showing the whole thing.
106
+
* `:guardrails/trace? true` - Shows the GR function call stack on failures (with argument values)
107
+
108
+
Try the above settings as shown. You can always see the full stack by calling `last-failure` (which is printed with any failures for convenience). The result is way less noisy, and often sufficient to find the problem. When it's not, the full stack trace is just a copy/paste away.
100
109
101
110
== Clojurescript Considerations
102
111
@@ -355,10 +364,6 @@ The default config goes in the root of the project as `guardrails.edn`:
355
364
:expound {:show-valid-values? true
356
365
:print-specs? true}
357
366
358
-
;; Nilable map of Malli pretty-printer options
359
-
:malli {:malli.dev.pretty/printer nil
360
-
:malli.dev.printer/actor nil}
361
-
362
367
;; Check specs in parallel (CLJ only)
363
368
:async? true
364
369
@@ -371,11 +376,26 @@ The default config goes in the root of the project as `guardrails.edn`:
371
376
;; call will be checked.
372
377
:guardrails/mcps 100
373
378
379
+
;; Low-level stack trace output
380
+
;; default :full
381
+
:guardrails/stack-trace :prune ; or :full or :none
382
+
383
+
;; nREPL hates using stderr, but in other REPLs seeing your problems in red is nice.
384
+
;; default false
385
+
:guardrails/use-stderr? true
386
+
387
+
;; Optional (default false). Compress the explanation of the problem.
388
+
:guardrails/compact? true
389
+
390
+
;; Keep track of the active GR-instrumented calls as a stack, and show that on errors.
391
+
;; default false
392
+
:guardrails/trace? true
393
+
374
394
;; should a spec failure on args or ret throw an exception?
375
395
;; (always logs an informative message)
376
396
:throw? false
377
397
378
-
;; should a spec failure be forwarded through tap> ?
0 commit comments