mirror of
https://github.com/taoensso/telemere.git
synced 2025-12-18 10:11:10 +00:00
[mod] Rename taoensso.telemere.api -> taoensso.telemere.shell
This commit is contained in:
parent
965c2277fd
commit
a9005e7f1c
6 changed files with 16 additions and 16 deletions
|
|
@ -49,7 +49,7 @@
|
||||||
[[org.clojure/test.check "1.1.1"]
|
[[org.clojure/test.check "1.1.1"]
|
||||||
[org.clojure/tools.logging "1.3.0"]
|
[org.clojure/tools.logging "1.3.0"]
|
||||||
[org.slf4j/slf4j-api "2.0.16"]
|
[org.slf4j/slf4j-api "2.0.16"]
|
||||||
[com.taoensso/telemere-api "1.0.0-SNAPSHOT"]
|
[com.taoensso/telemere-shell "1.0.0-SNAPSHOT"]
|
||||||
[com.taoensso/telemere-slf4j "1.0.0-SNAPSHOT"]
|
[com.taoensso/telemere-slf4j "1.0.0-SNAPSHOT"]
|
||||||
#_[org.slf4j/slf4j-simple "2.0.16"]
|
#_[org.slf4j/slf4j-simple "2.0.16"]
|
||||||
#_[org.slf4j/slf4j-nop "2.0.16"]
|
#_[org.slf4j/slf4j-nop "2.0.16"]
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
:refer [signal! with-signal with-signals]
|
:refer [signal! with-signal with-signals]
|
||||||
:rename {signal! sig!, with-signal with-sig, with-signals with-sigs}]
|
:rename {signal! sig!, with-signal with-sig, with-signals with-sigs}]
|
||||||
|
|
||||||
[taoensso.telemere.api :as api]
|
[taoensso.telemere.shell :as shell]
|
||||||
[taoensso.telemere.utils :as utils]
|
[taoensso.telemere.utils :as utils]
|
||||||
[taoensso.telemere.timbre :as timbre]
|
[taoensso.telemere.timbre :as timbre]
|
||||||
#_[taoensso.telemere.tools-logging :as tools-logging]
|
#_[taoensso.telemere.tools-logging :as tools-logging]
|
||||||
|
|
@ -275,7 +275,7 @@
|
||||||
|
|
||||||
[(is (= sv1 (read-string (pr-str sv1))))])))
|
[(is (= sv1 (read-string (pr-str sv1))))])))
|
||||||
|
|
||||||
(is (sm? (with-sig (api/signal! {:level :info})) {:level :info, :ns "taoensso.telemere-tests", :line :submap/some}) "API")])
|
(is (sm? (with-sig (shell/signal! {:level :info})) {:level :info, :ns "taoensso.telemere-tests", :line :submap/some}) "Shell API")])
|
||||||
|
|
||||||
(deftest _handlers
|
(deftest _handlers
|
||||||
;; Basic handler tests are in Encore
|
;; Basic handler tests are in Encore
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
(defproject com.taoensso/telemere-api "1.0.0-SNAPSHOT"
|
(defproject com.taoensso/telemere-shell "1.0.0-SNAPSHOT"
|
||||||
:author "Peter Taoussanis <https://www.taoensso.com>"
|
:author "Peter Taoussanis <https://www.taoensso.com>"
|
||||||
:description "Minimal Telemere facade API for library authors, etc."
|
:description "Minimal Telemere shell API for library authors, etc."
|
||||||
:url "https://www.taoensso.com/telemere"
|
:url "https://www.taoensso.com/telemere"
|
||||||
|
|
||||||
:license
|
:license
|
||||||
|
|
@ -1,15 +1,15 @@
|
||||||
(ns taoensso.telemere.api
|
(ns taoensso.telemere.shell
|
||||||
"Experimental, subject to change.
|
"Experimental, subject to change.
|
||||||
Minimal Telemere facade API for library authors, etc.
|
Minimal Telemere shell API for library authors, etc.
|
||||||
Allows library code to use Telemere if it's present, or fall back to
|
Allows library code to use Telemere if it's present, or fall back to
|
||||||
something like tools.logging otherwise."
|
something like tools.logging otherwise."
|
||||||
{:author "Peter Taoussanis (@ptaoussanis)"}
|
{:author "Peter Taoussanis (@ptaoussanis)"}
|
||||||
#?(:clj (:require [clojure.java.io :as jio])
|
#?(:clj (:require [clojure.java.io :as jio])
|
||||||
:cljs (:require-macros [taoensso.telemere.api :refer [compile-if]])))
|
:cljs (:require-macros [taoensso.telemere.shell :refer [compile-if]])))
|
||||||
|
|
||||||
(comment
|
(comment
|
||||||
(require '[taoensso.telemere :as t] '[taoensso.encore :as enc])
|
(require '[taoensso.telemere :as t] '[taoensso.encore :as enc])
|
||||||
(remove-ns 'taoensso.telemere.api)
|
(remove-ns 'taoensso.telemere.shell)
|
||||||
(:api (enc/interns-overview)))
|
(:api (enc/interns-overview)))
|
||||||
|
|
||||||
#?(:clj
|
#?(:clj
|
||||||
|
|
@ -53,7 +53,7 @@
|
||||||
#?(:clj
|
#?(:clj
|
||||||
(defmacro signal!
|
(defmacro signal!
|
||||||
"Experimental, subject to change.
|
"Experimental, subject to change.
|
||||||
Telemere facade API for library authors, etc.
|
Telemere shell API for library authors, etc.
|
||||||
|
|
||||||
Expands to `taoensso.telemere/signal!` call if Telemere is present.
|
Expands to `taoensso.telemere/signal!` call if Telemere is present.
|
||||||
Otherwise expands to arbitrary `fallback` opt form.
|
Otherwise expands to arbitrary `fallback` opt form.
|
||||||
|
|
@ -65,8 +65,8 @@
|
||||||
|
|
||||||
(ns my-lib
|
(ns my-lib
|
||||||
(:require
|
(:require
|
||||||
[taoensso.telemere.api :as t] ; `com.taoensso/telemere-api` dependency
|
[taoensso.telemere.shell :as t] ; `com.taoensso/telemere-shell` dependency
|
||||||
[clojure.tools.logging :as ctl] ; `org.clojure/tools.logging` dependency
|
[clojure.tools.logging :as ctl] ; `org.clojure/tools.logging` dependency
|
||||||
))
|
))
|
||||||
|
|
||||||
(t/require-telemere-if-present) ; Just below `ns` form!
|
(t/require-telemere-if-present) ; Just below `ns` form!
|
||||||
|
|
@ -85,7 +85,7 @@
|
||||||
{:arglists #_(taoensso.telemere.impl/signal-arglists :signal!) ; + fallback
|
{:arglists #_(taoensso.telemere.impl/signal-arglists :signal!) ; + fallback
|
||||||
'([{:as opts
|
'([{:as opts
|
||||||
:keys
|
:keys
|
||||||
[fallback, ; Unique to facade
|
[fallback, ; Unique to shell
|
||||||
#_defaults #_elide? #_allow? #_expansion-id, ; Undocumented
|
#_defaults #_elide? #_allow? #_expansion-id, ; Undocumented
|
||||||
elidable? location #_location* inst uid middleware,
|
elidable? location #_location* inst uid middleware,
|
||||||
sample-rate kind ns id level when rate-limit,
|
sample-rate kind ns id level when rate-limit,
|
||||||
|
|
@ -35,7 +35,7 @@ This way your users can easily disable, decrease, or increase signal output from
|
||||||
|
|
||||||
## 3. Telemere as an optional dependency
|
## 3. Telemere as an optional dependency
|
||||||
|
|
||||||
Include the (super lightweight) [Telemere facade API](https://clojars.org/com.taoensso/telemere-api) in your **library's dependencies**.
|
Include the (super lightweight) [Telemere shell API](https://clojars.org/com.taoensso/telemere-shell) in your **library's dependencies**.
|
||||||
|
|
||||||
Your library will then be able to emit structured logs/telemetry **when Telemere is present**, or fall back to something like [tools.logging](https://github.com/clojure/tools.logging) otherwise.
|
Your library will then be able to emit structured logs/telemetry **when Telemere is present**, or fall back to something like [tools.logging](https://github.com/clojure/tools.logging) otherwise.
|
||||||
|
|
||||||
|
|
@ -44,7 +44,7 @@ The main trade-off is that your signal calls will be more verbose:
|
||||||
```clojure
|
```clojure
|
||||||
(ns my-lib
|
(ns my-lib
|
||||||
(:require
|
(:require
|
||||||
[taoensso.telemere.api :as t] ; `com.taoensso/telemere-api` dependency
|
[taoensso.telemere.shell :as t] ; `com.taoensso/telemere-shell` dependency
|
||||||
[clojure.tools.logging :as ctl] ; `org.clojure/tools.logging` dependency
|
[clojure.tools.logging :as ctl] ; `org.clojure/tools.logging` dependency
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
@ -76,4 +76,4 @@ The main trade-off is that your signal calls will be more verbose:
|
||||||
:fallback (ctl/warn (str \"Hello world\" x))})
|
:fallback (ctl/warn (str \"Hello world\" x))})
|
||||||
```
|
```
|
||||||
|
|
||||||
See [here](https://cljdoc.org/d/com.taoensso/telemere-api/CURRENT/api/taoensso.telemere.api) for more info.
|
See [here](https://cljdoc.org/d/com.taoensso/telemere-shell/CURRENT/api/taoensso.telemere.shell) for more info.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue