Commit graph

314 commits

Author SHA1 Message Date
Peter Taoussanis
6b0e0b9fff [doc] Mention :inst monotonicity 2025-03-03 11:31:52 +01:00
Peter Taoussanis
bfea51570f [new] Alias keep-callsite, mention in signal! docs 2025-03-03 11:30:10 +01:00
Peter Taoussanis
ac5feb4723 [mod] [#53] Breaking: change return value of log!, event!
This change will only affect rare advanced users that depend on
the return value of `log!` or `event!`. For all other users this
will be a non-breaking change.

Before this commit:
  `log!` and `event!` returned true iff signal was allowed.

After this commit:
  `log!`  and `event!` now ALWAYS return nil.
  `log!?` and `event!?` have been added that keep the old behaviour.

Motivation:
  It's pretty rare to use the return value when generating log or event
  signals. I originally included the return value since it CAN be handy,
  and I figured it could just be ignored by those that don't need it.

  But #53 showed that there's a downside I hadn't anticipated - some
  users may actually depend on / prefer a nil return to prevent
  accidentally affecting program flow.

  I think that's a legitimate enough concern to still make a change now
  before v1 final.

  Apologies for the nuissance!
2025-03-03 11:19:36 +01:00
Peter Taoussanis
e32ed8deb5 [new] Add base-opts arg to impl signal creator 2025-03-03 11:01:39 +01:00
Peter Taoussanis
46e82f0816 [nop] Callsite housekeeping 2025-03-03 11:01:39 +01:00
Peter Taoussanis
ea20f6836b [nop] Un-alias public signal-allowed?, signal! macros 2025-03-03 11:01:39 +01:00
Peter Taoussanis
634cc53405 [mod] [#52] signal-preamble-fn should ignore nil :kind (@marksto)
Before this commit: A nil signal `:kind` renders as "DEFAULT".
After  this commit: A nil signal `:kind` isn't rendered at all.

The previous behaviour wasn't particularly useful, and as Mark
helpfully pointed out - makes it difficult to skip `:kind` rendering.

The new behaviour also better matches the behaviour for other signal
keys, which can mostly be dissoc'ed to skip rendering.
2025-03-03 11:01:39 +01:00
Peter Taoussanis
410ed8914c [fix] [#52] signal-preamble-fn should use host info in signal (@marksto) 2025-03-03 11:01:39 +01:00
Peter Taoussanis
78ed4d7f14 [mod] [#51] Make default console handler synchronous by default
This might be less surprising for beginners and new users, so
should probably be the default.
2025-03-03 11:01:39 +01:00
Peter Taoussanis
4fdc55e9b8 [nop] Misc docs houskeeping 2025-03-03 11:01:39 +01:00
Peter Taoussanis
a60f5b8d7c [nop] Bump deps 2025-03-03 11:01:39 +01:00
Peter Taoussanis
dd9f4b2a33 v1.0.0-RC3 (2025-02-27) 2025-02-27 13:04:29 +01:00
Peter Taoussanis
b7d2b4a1ed [nop] Bump deps 2025-02-27 12:45:01 +01:00
Peter Taoussanis
4a6771a907 [doc] Update info on experimental vars 2025-02-27 12:45:01 +01:00
Peter Taoussanis
824f8e3d53 [doc] Rename "signal filters" -> "call filters", etc.
The new terminology hopefully makes the distinction clearer
between call filters and handler filters, etc.
2025-02-27 12:45:01 +01:00
Peter Taoussanis
fda22ce80c [mod] Signal options: drop :location, add :coords
This is the input-side change related to [1], and only
affects folks who've been providing custom callsite info to
Telemere signals (usually in the context of wrapper macros).

To provide custom callsite info BEFORE this commit:
  (tel/signal! {:location {:ns "my-ns", :line 10, :column 20}})

To provide custom callsite info AFTER this commit:
  (tel/signal! {:ns "my-ns", :coords [10 20]})

Motivation for the new override API:

  - It's shorter and cleaner.
  - It's less likely to cause confusion since it avoids the
    redundant signal keys (signals previously contained callsite
    info in 2 duplicate places).
  - The underlying implementation is simpler.
  - The util for manually getting coords is easier to use and doesn't
    require macro-time environment info, making it easier for folks
    to write wrapper macros that include line + column info.
  - When embedded, the new callsite info is shorter and easier for
    Cljs advanced compilation to de-duplicate (so helps reduce .js
    build size).

[1] Commit 1f99f7186b
2025-02-27 12:44:55 +01:00
Peter Taoussanis
1f99f7186b [mod] Signal content: drop :location, add :coords
This is a BREAKING change to get in before v1 final.

Signal keys BEFORE this commit:
  `:location` ---- ?{:keys [ns file line column]} signal creator callsite
  `:ns` ---------- ?str namespace of signal creator callsite, same as (:ns     location)
  `:line` -------- ?int line      of signal creator callsite, same as (:line   location)
  `:column` ------ ?int column    of signal creator callsite, same as (:column location)
  `:file` -------- ?str filename  of signal creator callsite, same as (:file   location)

Signal keys AFTER this commit:
  `:ns` ---------- ?str namespace of signal creator callsite
  `:coords` ------ ?[line column] of signal creator callsite

Motivation for the breaking change:

  The new callsite schema is simpler to use/override, reduces noise, and can reduce
  code expansion size (and so Cljs build size).

  - `:file` was rarely useful, but often added large embedded strings.
  - `:location` was redundant, and often difficult for Closure's
    advanced build to properly de-duplicate.

  This schema will be shared by Truss v2 and Tufte v3.
2025-02-27 12:44:30 +01:00
Peter Taoussanis
bb715fb206 [mod] OpenTelemetry: use standard attribute names when possible 2025-02-26 19:25:23 +01:00
Peter Taoussanis
2c5599c234 [nop] Update to Truss v2 2025-02-26 19:25:23 +01:00
Peter Taoussanis
97efef3d40 [doc] Update signal flow diagram 2025-02-26 17:11:30 +01:00
Peter Taoussanis
2795a6cd52 [nop] Drop enc/pred pattern 2025-02-26 17:11:30 +01:00
Peter Taoussanis
94f13e44f9 [nop] Tweak macro hygiene 2025-02-24 21:56:38 +01:00
Peter Taoussanis
fc7e748ac8 [nop] Stop using optimised binding by default
The improved performance rarely matters in practice, and can
cause issues for folks using deep-walking macros.

Better solution would be to eventually get the optimisation
implemented upstream in Clojure core.
2025-02-24 10:28:24 +01:00
Peter Taoussanis
feb2f64f92 [nop] Drop codox docs 2025-02-20 22:56:30 +01:00
Peter Taoussanis
af14494637 [doc] Misc improvements 2025-02-12 09:18:44 +01:00
Peter Taoussanis
35606d971d [fix] [#45] spy! docstring typo (@rafd) 2025-01-22 14:52:38 +01:00
Peter Taoussanis
7d4aed60d8 [doc] Misc improvements 2025-01-22 14:52:38 +01:00
Peter Taoussanis
f984cdd213 [nop] Simplify dir structure 2025-01-14 10:35:25 +01:00
Peter Taoussanis
db26a5d683 [fix] Fix environment val docs 2025-01-13 23:30:56 +01:00
Vladimir Pouzanov
413cce87c3 [new] [#44] Open Telemetry handler: add span kind option (@farcaller) 2025-01-03 16:19:09 +01:00
lvh
db0498b22c [doc] [#43] Note that ns filters work for SLF4J logger names (@lvh) 2024-12-31 16:16:36 +01:00
Peter Taoussanis
0e642ba21f [fix] Timbre shim: don't attach empty :vargs data 2024-12-31 12:28:22 +01:00
Peter Taoussanis
1517f30abf [doc] [#42] Timbre shim: document different spy error handling 2024-12-31 12:28:22 +01:00
Peter Taoussanis
3a9ffc6206 [fix] [#42] Timbre shim: rename spy! -> spy (@lvh) 2024-12-31 12:17:43 +01:00
Peter Taoussanis
8c7caf45fa v1.0.0-SNAPSHOT 2024-12-31 09:46:02 +01:00
Peter Taoussanis
17dcde97aa v1.0.0-RC2 (2024-12-24) 2024-12-24 11:19:33 +01:00
Peter Taoussanis
a04f255146 [new] Add & opts support to signal!, signal-allowed? 2024-12-24 10:35:11 +01:00
Peter Taoussanis
8cd4ca97e6 [doc] [#33] Add community examples link to Bling Gist 2024-12-24 10:35:07 +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
ace6e2dd2c [new] Add timbre->telemere appender and update docs 2024-12-23 11:19:05 +01:00
Peter Taoussanis
d563ac1259 [new] Better error message when signal! given non-map arg 2024-12-22 13:58:03 +01:00
Peter Taoussanis
f522307ee0 [fix] Trace formatting: always include root info 2024-12-22 13:58:03 +01:00
Peter Taoussanis
68a894edab [fix] Trace formatting: properly format nil ids 2024-12-22 13:58:03 +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
Damiano Ruehl
0822217480 [new] [#34] Add new signal-preamble-fn opts (@Knotschi)
New opts:

  - `:format-id-fn`
  - `:format-msg-fn`

This way its easier to reuse signal-preamble-fn for custom handlers.
If nil is passed as any format fn: value won't be logged.
The `-` char before the msg is now part of the formatter fn.
2024-12-22 13:58:03 +01:00
Peter Taoussanis
9dc9a4645b [new] Alias low-level formatters in utils ns 2024-12-22 13:58:03 +01:00