Commit graph

25 commits

Author SHA1 Message Date
Peter Taoussanis
3a9ffc6206 [fix] [#42] Timbre shim: rename spy! -> spy (@lvh) 2024-12-31 12:17:43 +01:00
Peter Taoussanis
8412ac29f2 [nop] Tests: remove unnecessary submap pred 2024-12-23 23:04:40 +01:00
Peter Taoussanis
cb6a5d9e1b [mod] NB Change return value of experimental with-signals
The old (deeply-nested) return value seemed to be difficult
for users to read, and prone to mistakes when destructuring.

The new (map) return value is a little more verbose, but
more obvious and less error-prone. Overall a good trade-off
given that this util is anyway used mostly for debugging
or unit tests.
2024-12-23 23:04:40 +01:00
Peter Taoussanis
5c977a348b [doc] Better document pattern of using trace!/spy! with catch->error! 2024-12-23 23:04:40 +01:00
Peter Taoussanis
0de5c094e5 [mod] Remove advanced options from catch->error!
`catch->error!` with default opts is quite handy for use with `trace!`/`spy!`.

But there's a lot that users might want to customize, including:

  - Exactly what error type to catch.
  - Whether or not to rethrow on catch.
  - Error binding sym to enable use within signal message, data, etc.

We could support all of this via `catch->error!` opts but there's not much
point. If anyway customizing such behaviour, it'd be better for the user to just
use an appropriate `try/catch`.

So I've now documented this recommendation, and removed all but the most basic
(:catch-val) options.

This is a BREAKING change for anyone that was previously using any of the
following options:

  :rethrow?
  :catch-sym

Note that `:rethrow?` was never particularly helpful (independently of
`:catch-val` anyway), and the removal of `:catch-sym` will throw a compile-time
error for any existing users.
2024-12-23 23:04:40 +01:00
Peter Taoussanis
d2386d62f1 [new] Refactor impln of common signal creators
Objectives:

  - Support single map opts arg in all cases.

  - Make it easier for folks to inspect the source to understand how
    the common creators use/wrap underlying `signal!`.

Also updated relevant docstrings, etc.
2024-12-23 12:30:00 +01:00
Peter Taoussanis
d61f6c25e3 [mod] Remove "- " msg separator from default preamble output
Better to make this optional through the new `:format-msg-fn` option
available for `signal-preamble-fn`
2024-12-22 13:58:03 +01:00
Peter Taoussanis
096c432eff [mod] [#39] Remove shell API 2024-12-22 13:58:03 +01:00
Peter Taoussanis
7eb46ff555 [nop] Misc housekeeping 2024-12-22 13:58:03 +01:00
Peter Taoussanis
9dc883dce9 [new] Allow manual :run-val override
Useful for eliding noisy/long vals from tracing, etc.
2024-12-20 15:49:53 +01:00
Peter Taoussanis
5a8c407528 [new] Add :ctx+, :middleware+ signal options 2024-10-29 10:02:12 +01:00
Peter Taoussanis
5ac872566a [new] Add dispatch-signal! util 2024-10-29 10:02:12 +01:00
Peter Taoussanis
7f52cb1843 [fix] uncaught->error! wasn't working (@benalbrecht)
`__thread` handler arg was being masked by `__thread` in signal implementation,
Ref. https://clojurians.slack.com/archives/C06ALA6EEUA/p1727713025725089
2024-10-29 10:02:12 +01:00
Peter Taoussanis
88f7a3c7d6 [fix] Don't count non-list run forms 2024-09-23 09:14:29 +02:00
Peter Taoussanis
cbab57be66 [fix] [#21] Work around issue with use in Cljs core.async/go bodies
Problem:
  (clojure.core.async/go (taoensso.telemere/log! "hello")) ; Compiles fine
  (cljs.core.async/go    (taoensso.telemere/log! "hello")) ; Compile fails

I could try to get to the bottom of exactly what's going on - but ultimately
IOC mechanisms like `go` are always going to be a bit fragile, especially for
heavily-optimized/unusual code.

In this case, the problem is thankfully only with Cljs - and Telemere's Cljs
performance isn't too critical - so I think we can afford to just bypass any
potential fiddling by the `go` macro by wrapping Cljs Telemere expansions in
an IIFE ((fn [] ...)).

Downside is the (small) added cost of a function construction and call.
Upside   is avoiding potential issues with core.async and other similar
IOC-style systems (Electric Clojure, etc.)
2024-09-20 22:55:12 +02:00
Peter Taoussanis
be55f44a87 [new] Add clean-signal-fn util 2024-09-20 22:55:12 +02:00
Peter Taoussanis
d12b0b145b [new] Add signal-allowed? util
Useful for using Telemere's filtering features without generating
any signals, etc.
2024-09-20 22:55:12 +02:00
Peter Taoussanis
a9005e7f1c [mod] Rename taoensso.telemere.api -> taoensso.telemere.shell 2024-09-20 22:55:12 +02:00
Peter Taoussanis
f52a04b4dc [fix] [#18] Support {:uid :auto} for non-tracing signal creators 2024-09-20 22:55:12 +02:00
Peter Taoussanis
e4a0a41a1b [doc] Misc improvements 2024-09-20 22:55:12 +02:00
Peter Taoussanis
f9564b2fc5 [nop] Misc improvements 2024-09-20 09:37:28 +02:00
Peter Taoussanis
ece51b2ef6 [new] Add experimental facade API for lib authors, etc. 2024-08-28 18:26:52 +02:00
Peter Taoussanis
0f09b797ed [fix] More robust mechanism for retaining nested macro callsite info 2024-08-28 16:54:57 +02:00
Peter Taoussanis
0e4942e99c [fix] :line unit tests 2024-08-28 16:54:55 +02:00
Peter Taoussanis
19cd1af3a4 [nop] Restructure repo 2024-08-28 16:53:31 +02:00