Comments (3)
@ftravers Hi Fenton!
This should work, and seems to work on my side-
(binding [timbre/*config*
{:min-level :info
:appenders
{:my-appender
{:enabled? true
:min-level [[#{"*"} :warn]]
:fn (fn [_] (println "Handler called"))}}}]
(timbre/info "Test"))
- With
:my-appender {... :min-level [[#{"*"} :info]] ...}
I see "Handler called" - With
:my-appender {... :min-level [[#{"*"} :warn]] ...}
I see no "Handler called"
Is it different on your side? If so, what version of Timbre are you using?
Are you sure your namespace is correct?
from timbre.
I seem to be having a similar issue, and I'm assuming I just don't understand how the namespace selectors work. I'm using timbre 6.5.0 in a lein project. Trying to get to a sane baseline, I put the following line in core.clj
just after the ns
expression which includes [taoensso.timbre :as log]
:
(binding [log/*config* {:min-level [[#{"*"} :info]]}])
I assumed that that would prevent any log messages below INFO, but I'm still getting DEBUG log messages. If I instead use
(log/set-level! :info)
this works to suppress any messages below the level of INFO, but then I lack the granularity to set levels based on namespaces. Any ideas what I may be doing wrong with my usage of *config*
?
from timbre.
@jayemar Hi Joe,
I put the following line in core.clj just after the ns expression which includes [taoensso.timbre :as log]: (binding [log/config {:min-level [[#{"*"} :info]]}])
Just to confirm, this is literally the exact binding expression that you used? If so, that won't do anything since Clojure's binding
macro applies its binding only to the form that it encloses. I.e. it won't affect the rest of your program, only the contents of that one form (and in this case the contents are empty).
The docstring explains this in some more detail.
If you want to set Timbre's minimum level throughout your program, you can call set-min-level!
or set-ns-min-level!
as described in the Timbre wiki.
There's some more info on general config here.
Just let me know if any of that is unclear 👍
from timbre.
Related Issues (20)
- Why are my Timbre timezones different than the system ones? HOT 3
- [shadow-cljs] Invalid :refer, var taoensso.encore/have does not exist HOT 26
- IllegalAccessException when logging internal JDK exception (SunCertPathBuilderException) via `log/error` HOT 13
- shadow-cljs: Advanced build bloated since 6.0.3 HOT 6
- Exception thrown when log arguments have same name, but different separators HOT 2
- Timbre crashing Cider workflow (?) HOT 9
- Using TAOENSSO_TIMBRE_CONFIG_EDN environment variable leads to an execption HOT 4
- Need some help/advice: No debug or info level logging, and duplicated message content HOT 10
- Add console appender opt to control `:raw-console?` HOT 1
- Link to Portal Timbre guide HOT 1
- Latest release uses older com.taoensso/encore; order-dependent if used with e.g. Tufte HOT 2
- API docs link from README results in 404 HOT 3
- Graal optimizations may break uberjar running HOT 6
- Seeing a lot of deprecation warnings in our log HOT 13
- Lots of Encore warnings HOT 3
- How to add appenders in the edn configuration? HOT 5
- Timbre v7
- Skipping a message for a specific appender HOT 6
- [TIMBRE WARNING]: `error-fn` failed, falling back to `pr-str` HOT 28
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from timbre.