Comments (5)
Hi Julius,
I am not sure if it is appropriate to put question here, please close it if it not.
Sure, this is the right place to ask :-)
I make a poor workaround by copying def-loggers and so on into the logging.clj file in my personal project.
Can you explain what you want to do here exactly? Do you want to change something in def-logger
or ordered-levels
?
If you just want the logging macros (info
, infof
, error
, errorf
, etc.) to be available to your namespace, I would usually recommend doing that with something like:
(ns my-app (:require [taoensso.timbre :as timbre
:refer (trace debug info warn error fatal spy with-log-level)]))
But maybe I misunderstand you?
from timbre.
:), I just want the source codes refer to those macros under my namespace (:require [logging :as log]) like t_logging.clj instead of
[taoensso.timbre :as timbre
:refer (trace debug info warn error fatal spy with-log-level)]
from timbre.
Okay, I think I understand. I think using def-loggers
in your own ns is maybe a bad idea. It would be better to use :require
and :refer
.
If :refer (trace debug info warn error fatal spy with-log-level)
is too long, you can write a fn like this:
(defn require-timbre []
(require '[taoensso.timbre :as timbre :refer (trace debug info warn error fatal spy with-log-level)])
Then you can call (require-timbre)
under your ns form. I will think about adding this to Timbre officially.
Another idea: you can require log
or logf
which lets you choose a logging level yourself, like (log :info "Log this")
.
Does that help?
from timbre.
Okay, I have added refer-timbre
to v2.4.0
.
from timbre.
It does help, Thanks a lot. Actually what I did is not about to save the time to press the long require statement, I want to abstract the logging interface, so that the code will not be changed a lot after switching the logging implementation.
from timbre.
Related Issues (20)
- cljs: JS objects are printed uselessly HOT 2
- Update io.aviso/pretty to 1.2 HOT 1
- Support for `nbb` HOT 2
- Community appenders no longer included in 6.0.0 HOT 2
- 6.0.1. breaks in GraalVM native-image HOT 11
- Add test/s re: GraalVM compatibility HOT 1
- 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
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.