mirror of
https://github.com/taoensso/telemere.git
synced 2026-02-19 17:21:04 +00:00
Compare commits
3 commits
ffc9657bac
...
67d6468593
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
67d6468593 | ||
|
|
070fe88abb | ||
|
|
dcfeba5b91 |
3 changed files with 44 additions and 23 deletions
|
|
@ -334,7 +334,7 @@ See [here](../../wiki/8-Community) for community resources.
|
||||||
|
|
||||||
## Funding
|
## Funding
|
||||||
|
|
||||||
You can [help support][sponsor] continued work on this project, thank you!! 🙏
|
You can [help support][sponsor] continued work on this project and [others][my work], thank you!! 🙏
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|
@ -346,10 +346,11 @@ Licensed under [EPL 1.0](LICENSE.txt) (same as Clojure).
|
||||||
[GitHub releases]: ../../releases
|
[GitHub releases]: ../../releases
|
||||||
[GitHub issues]: ../../issues
|
[GitHub issues]: ../../issues
|
||||||
[GitHub wiki]: ../../wiki
|
[GitHub wiki]: ../../wiki
|
||||||
[Slack channel]: https://www.taoensso.com/telemere/slack
|
[Slack channel]: https://www.taoensso.com/telemere/slack
|
||||||
|
|
||||||
[Peter Taoussanis]: https://www.taoensso.com
|
[Peter Taoussanis]: https://www.taoensso.com
|
||||||
[sponsor]: https://www.taoensso.com/sponsor
|
[sponsor]: https://www.taoensso.com/sponsor
|
||||||
|
[my work]: https://www.taoensso.com/clojure-libraries
|
||||||
|
|
||||||
<!-- Project -->
|
<!-- Project -->
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -391,7 +391,7 @@
|
||||||
:signal! ; opts => allowed? / run result (value or throw)
|
:signal! ; opts => allowed? / run result (value or throw)
|
||||||
'( [& opts-kvs]
|
'( [& opts-kvs]
|
||||||
[{:as opts-map :keys
|
[{:as opts-map :keys
|
||||||
[elidable? coords inst uid xfn xfn+,
|
[elidable? coords inst uid xfn xfn+ #_kvs+,
|
||||||
sample kind ns id level when limit limit-by,
|
sample kind ns id level when limit limit-by,
|
||||||
ctx ctx+ parent root trace?, do let data msg error run & kvs]}])
|
ctx ctx+ parent root trace?, do let data msg error run & kvs]}])
|
||||||
|
|
||||||
|
|
@ -399,7 +399,7 @@
|
||||||
'([opts-or-msg]
|
'([opts-or-msg]
|
||||||
[level msg]
|
[level msg]
|
||||||
[{:as opts-map :keys
|
[{:as opts-map :keys
|
||||||
[elidable? coords inst uid xfn xfn+,
|
[elidable? coords inst uid xfn xfn+ #_kvs+,
|
||||||
sample kind ns id level when limit limit-by,
|
sample kind ns id level when limit limit-by,
|
||||||
ctx ctx+ parent root trace?, do let data msg error #_run & kvs]}
|
ctx ctx+ parent root trace?, do let data msg error #_run & kvs]}
|
||||||
msg])
|
msg])
|
||||||
|
|
@ -409,7 +409,7 @@
|
||||||
[id level]
|
[id level]
|
||||||
[id
|
[id
|
||||||
{:as opts-map :keys
|
{:as opts-map :keys
|
||||||
[elidable? coords inst uid xfn xfn+,
|
[elidable? coords inst uid xfn xfn+ #_kvs+,
|
||||||
sample kind ns id level when limit limit-by,
|
sample kind ns id level when limit limit-by,
|
||||||
ctx ctx+ parent root trace?, do let data msg error #_run & kvs]}])
|
ctx ctx+ parent root trace?, do let data msg error #_run & kvs]}])
|
||||||
|
|
||||||
|
|
@ -417,7 +417,7 @@
|
||||||
'([opts-or-run]
|
'([opts-or-run]
|
||||||
[id run]
|
[id run]
|
||||||
[{:as opts-map :keys
|
[{:as opts-map :keys
|
||||||
[elidable? coords inst uid xfn xfn+,
|
[elidable? coords inst uid xfn xfn+ #_kvs+,
|
||||||
sample kind ns id level when limit limit-by,
|
sample kind ns id level when limit limit-by,
|
||||||
ctx ctx+ parent root trace?, do let data msg error run & kvs]}
|
ctx ctx+ parent root trace?, do let data msg error run & kvs]}
|
||||||
run])
|
run])
|
||||||
|
|
@ -426,7 +426,7 @@
|
||||||
'([opts-or-run]
|
'([opts-or-run]
|
||||||
[level run]
|
[level run]
|
||||||
[{:as opts-map :keys
|
[{:as opts-map :keys
|
||||||
[elidable? coords inst uid xfn xfn+,
|
[elidable? coords inst uid xfn xfn+ #_kvs+,
|
||||||
sample kind ns id level when limit limit-by,
|
sample kind ns id level when limit limit-by,
|
||||||
ctx ctx+ parent root trace?, do let data msg error run & kvs]}
|
ctx ctx+ parent root trace?, do let data msg error run & kvs]}
|
||||||
run])
|
run])
|
||||||
|
|
@ -435,7 +435,7 @@
|
||||||
'([opts-or-error]
|
'([opts-or-error]
|
||||||
[id error]
|
[id error]
|
||||||
[{:as opts-map :keys
|
[{:as opts-map :keys
|
||||||
[elidable? coords inst uid xfn xfn+,
|
[elidable? coords inst uid xfn xfn+ #_kvs+,
|
||||||
sample kind ns id level when limit limit-by,
|
sample kind ns id level when limit limit-by,
|
||||||
ctx ctx+ parent root trace?, do let data msg error #_run & kvs]}
|
ctx ctx+ parent root trace?, do let data msg error #_run & kvs]}
|
||||||
error])
|
error])
|
||||||
|
|
@ -445,7 +445,7 @@
|
||||||
[id run]
|
[id run]
|
||||||
[{:as opts-map :keys
|
[{:as opts-map :keys
|
||||||
[catch-val,
|
[catch-val,
|
||||||
elidable? coords inst uid xfn xfn+,
|
elidable? coords inst uid xfn xfn+ #_kvs+,
|
||||||
sample kind ns id level when limit limit-by,
|
sample kind ns id level when limit limit-by,
|
||||||
ctx ctx+ parent root trace?, do let data msg error #_run & kvs]}
|
ctx ctx+ parent root trace?, do let data msg error #_run & kvs]}
|
||||||
run])
|
run])
|
||||||
|
|
@ -454,7 +454,7 @@
|
||||||
'([]
|
'([]
|
||||||
[opts-or-id]
|
[opts-or-id]
|
||||||
[{:as opts-map :keys
|
[{:as opts-map :keys
|
||||||
[elidable? coords inst uid xfn xfn+,
|
[elidable? coords inst uid xfn xfn+ #_kvs+,
|
||||||
sample kind ns id level when limit limit-by,
|
sample kind ns id level when limit limit-by,
|
||||||
ctx ctx+ parent root trace?, do let data msg error #_run & kvs]}])
|
ctx ctx+ parent root trace?, do let data msg error #_run & kvs]}])
|
||||||
|
|
||||||
|
|
@ -602,13 +602,20 @@
|
||||||
(get opts :xfn `taoensso.telemere/*xfn*))
|
(get opts :xfn `taoensso.telemere/*xfn*))
|
||||||
|
|
||||||
kvs-form
|
kvs-form
|
||||||
(not-empty
|
(let [base
|
||||||
(dissoc opts
|
(not-empty
|
||||||
:elidable? :coords :inst :uid :xfn :xfn+,
|
(dissoc opts
|
||||||
:sample :ns :kind :id :level :filter :when #_:limit #_:limit-by,
|
:elidable? :coords :inst :uid :xfn :xfn+ :kvs+,
|
||||||
:ctx :ctx+ :parent #_:trace?, :do :let :data :msg :error,
|
:sample :ns :kind :id :level :filter :when #_:limit #_:limit-by,
|
||||||
:run :run-form :run-val, :elide? :allow? #_:callsite-id,
|
:ctx :ctx+ :parent #_:trace?, :do :let :data :msg :error,
|
||||||
:host :thread :otel/context))
|
:run :run-form :run-val, :elide? :allow? #_:callsite-id,
|
||||||
|
:host :thread :otel/context))]
|
||||||
|
|
||||||
|
(if-let [kvs+ (get opts :kvs+)] ; Undocumented
|
||||||
|
(if base
|
||||||
|
`(not-empty (conj ~base ~kvs+))
|
||||||
|
`(not-empty ~kvs+))
|
||||||
|
base))
|
||||||
|
|
||||||
_ ; Compile-time validation
|
_ ; Compile-time validation
|
||||||
(do
|
(do
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,30 @@
|
||||||
Are you a library author/maintainer that's considering **using Telemere in your library**?
|
Are you a library author/maintainer that's considering **using Telemere in your library**?
|
||||||
|
|
||||||
You have **two options** below-
|
You have **a few options** below-
|
||||||
|
|
||||||
# Options
|
# Options
|
||||||
## 1. Common logging facade (basic logging only)
|
|
||||||
|
|
||||||
Many libraries need only basic logging. In these cases it can be beneficial to do your logging through a common logging facade like [tools.logging](https://github.com/clojure/tools.logging) or [SLF4J](https://www.slf4j.org/).
|
## Modern logging facade
|
||||||
|
|
||||||
This'll limit you to basic features (e.g. no structured logging or [rich filtering](https://cljdoc.org/d/com.taoensso/telemere/CURRENT/api/taoensso.telemere#get-filters)) - but your users will have the freedom to choose and configure their **preferred backend** ([incl. Telemere if they like](./3-Config#interop)).
|
[Trove](https://www.taoensso.com/trove) is a minimal, modern alternative to [tools.logging](https://github.com/clojure/tools.logging) that supports all of Telemere's structured logging and rich filtering features.
|
||||||
|
|
||||||
## 2. Telemere as a transitive dependency
|
Basically:
|
||||||
|
|
||||||
Include [Telemere](https://clojars.org/com.taoensso/telemere) in your **library's dependencies**. Your library (and users) will then have access to the full Telemere API.
|
1. You include the (very small) Trove dependency with your library
|
||||||
|
2. Your library logs using the [Trove API](https://github.com/taoensso/trove#to-choose-a-backend)
|
||||||
|
3. Your users then [choose](https://github.com/taoensso/trove#to-choose-a-backend) their preferred backend (Telemere, etc.)
|
||||||
|
|
||||||
|
This would be my first recommendation, and is what I'm planning to use for future updates to [Sente](https://www.taoensso.com/sente), [Carmine](https://www.taoensso.com/carmine), etc.
|
||||||
|
|
||||||
|
## Traditional logging facade (basic logging only)
|
||||||
|
|
||||||
|
Many libraries need only basic logging. In these cases it can be beneficial to do your logging through a common traditional logging facade like [tools.logging](https://github.com/clojure/tools.logging) or [SLF4J](https://www.slf4j.org/).
|
||||||
|
|
||||||
|
Though these'll limit you to basic features (e.g. no structured logging or [rich filtering](https://cljdoc.org/d/com.taoensso/telemere/CURRENT/api/taoensso.telemere#get-filters)).
|
||||||
|
|
||||||
|
## Telemere as a transitive dependency
|
||||||
|
|
||||||
|
You could just include [Telemere](https://clojars.org/com.taoensso/telemere) in your **library's dependencies**. Your library (and users) will then have access to the full Telemere API.
|
||||||
|
|
||||||
Telemere's [default config](./1-Getting-started#default-config) is sensible (with println-like console output), so your users are unlikely to need to configure or interact with Telemere much unless they choose to.
|
Telemere's [default config](./1-Getting-started#default-config) is sensible (with println-like console output), so your users are unlikely to need to configure or interact with Telemere much unless they choose to.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue