Commit graph

62 commits

Author SHA1 Message Date
Vladimir Pouzanov
413cce87c3 [new] [#44] Open Telemetry handler: add span kind option (@farcaller) 2025-01-03 16:19:09 +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
a04f255146 [new] Add & opts support to signal!, signal-allowed? 2024-12-24 10:35:11 +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
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
Peter Taoussanis
096c432eff [mod] [#39] Remove shell API 2024-12-22 13:58:03 +01:00
Peter Taoussanis
706a8b6d37 [mod] Postal handler now uses default preamble fn for email subject 2024-12-22 13:58:03 +01:00
Peter Taoussanis
55323f1f54 [mod] Default signal-content-fn: omit redundant parent/root id namespaces 2024-12-22 13:58:03 +01:00
Peter Taoussanis
b208532788 [mod] Default signal-content-fn: swap ctx, kvs position 2024-12-22 13:58:03 +01:00
Peter Taoussanis
0464285ce1 [mod] Default signal-content-fn: omit :root if it's same as parent 2024-12-22 13:58:03 +01:00
Peter Taoussanis
7eb46ff555 [nop] Misc housekeeping 2024-12-22 13:58:03 +01:00
Peter Taoussanis
cca8bb33ff [doc] Misc improvements 2024-12-22 13:58:03 +01:00
Peter Taoussanis
484b3df122 [new] Improve error info on worst-case handler errors 2024-12-22 13:50:01 +01:00
Peter Taoussanis
7532c2eca5 [new] Give signal! a default kind and level 2024-12-22 13:49:53 +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
d78663a528 [new] Omit empty :data, :ctx from signal content output 2024-12-20 15:49:53 +01:00
Peter Taoussanis
385c671756 [new] Add private format-location util 2024-12-20 15:49:53 +01:00
Peter Taoussanis
b58ec7359d [fix] [#36] Fix missing cljdoc docstrings
These remote declarations were unnecessary (vestigial), and seemed
to be causing issues with cljdoc's analysis.
2024-12-20 15:49:53 +01:00
Peter Taoussanis
8c701d4df5 [fix] Signal string representation 2024-12-20 14:38:40 +01:00
Peter Taoussanis
70ccfcfd80 [nop] Bump deps 2024-12-20 14:38:40 +01:00
Peter Taoussanis
b5680c5cb7 [nop] Housekeeping 2024-10-29 10:11:13 +01:00
Peter Taoussanis
0ca48fa6a1 [doc] Misc improvements 2024-10-29 10:02:13 +01:00
Peter Taoussanis
5a8c407528 [new] Add :ctx+, :middleware+ signal options 2024-10-29 10:02:12 +01:00
Peter Taoussanis
c1e1c1e4cc [new] OpenTelemetry handler: try print map vals as EDN 2024-10-29 10:02:12 +01:00
Peter Taoussanis
5ef4f12c6e [new] [#28] OpenTelemetry handler: support custom signal attrs
Thanks to @benalbrecht for assistance on this feature!
2024-10-29 10:02:12 +01:00
Peter Taoussanis
19548d3fac [new] Simplify default OpenTelemetry providers code, expose SDK 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
9965450f5b [new] writeable-file!: resolve sym links, etc. 2024-10-29 10:02:12 +01:00
Peter Taoussanis
d0ad99d528 [new] Extend IIFE-wrap to Clj
The perf hit is negligible, and we can always re-evaluate this choice again
later. In the meantime, let's err on the side of greatest compatibility.
2024-10-29 10:02:12 +01:00
Peter Taoussanis
f7a56631c5 [fix] signal-opts: allow map forms as intended 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
ecf4824f6b [nop] Bump deps 2024-10-29 09:48:36 +01:00
Peter Taoussanis
0a3e3e80c6 v1.0.0-beta25 (2024-09-25) 2024-09-25 09:14:48 +02:00
Peter Taoussanis
88f7a3c7d6 [fix] Don't count non-list run forms 2024-09-23 09:14:29 +02:00
Peter Taoussanis
85772f7335 [new] Cap length of displayed run-form when tracing 2024-09-22 10:38:10 +02:00
Peter Taoussanis
c9e84e8b38 [new] Avoid duplicated trace bodies
Trade off a small performance hit with tracing to avoid duplication
of potentially large expansions, and to help further eliminate potential
issues when embedding within IOT-style macros (`core.async/go`, etc.)
2024-09-20 22:55:12 +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
568906c96b [fix] [#20] Wrong :arglists meta on spy! 2024-09-20 22:55:12 +02:00
Peter Taoussanis
d9c3583631 [new] Add :rate-limit-by option to all signal creators
When present, will cause limits to be per [expansion, by-value]
2024-09-20 22:55:12 +02:00
Peter Taoussanis
f703630914 [mod] Update pr-signal-fn to use clean-signal-fn 2024-09-20 22:55:12 +02:00