Skip to content

Commit 6748dcb

Browse files
committed
Update fn docs to suggest using the readable ns
1 parent 658e7d2 commit 6748dcb

File tree

1 file changed

+30
-15
lines changed

1 file changed

+30
-15
lines changed

src/main/clojure/clojure/tools/logging.clj

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@
8181

8282
(defmacro logp
8383
"Logs a message using print style args. Can optionally take a throwable as its
84-
second arg. See level-specific macros, e.g., debug."
84+
second arg. See level-specific macros, e.g., debug.
85+
Use the 'logging.readable' namespace to avoid wrapping args in pr-str."
8586
{:arglists '([level message & more] [level throwable message & more])}
8687
[level x & more]
8788
(if (or (instance? String x) (nil? more)) ; optimize for common case
@@ -95,7 +96,8 @@
9596

9697
(defmacro logf
9798
"Logs a message using a format string and args. Can optionally take a
98-
throwable as its second arg. See level-specific macros, e.g., debugf."
99+
throwable as its second arg. See level-specific macros, e.g., debugf.
100+
Use the 'logging.readable' namespace to avoid wrapping args in pr-str."
99101
{:arglists '([level fmt & fmt-args] [level throwable fmt & fmt-args])}
100102
[level x & more]
101103
(if (or (instance? String x) (nil? more)) ; optimize for common case
@@ -134,7 +136,8 @@
134136

135137
(defmacro spyf
136138
"Evaluates expr and may write (format fmt result) to the log. Returns the
137-
result of expr. Defaults to :debug log level."
139+
result of expr. Defaults to :debug log level.
140+
Use the 'logging.readable' namespace to avoid wrapping args in pr-str."
138141
([fmt expr]
139142
`(spyf :debug ~fmt ~expr))
140143
([level fmt expr]
@@ -211,73 +214,85 @@
211214
;; level-specific macros
212215

213216
(defmacro trace
214-
"Trace level logging using print-style args."
217+
"Trace level logging using print-style args.
218+
Use the 'logging.readable' namespace to avoid wrapping args in pr-str."
215219
{:arglists '([message & more] [throwable message & more])}
216220
[& args]
217221
`(logp :trace ~@args))
218222

219223
(defmacro debug
220-
"Debug level logging using print-style args."
224+
"Debug level logging using print-style args.
225+
Use the 'logging.readable' namespace to avoid wrapping args in pr-str."
221226
{:arglists '([message & more] [throwable message & more])}
222227
[& args]
223228
`(logp :debug ~@args))
224229

225230
(defmacro info
226-
"Info level logging using print-style args."
231+
"Info level logging using print-style args.
232+
Use the 'logging.readable' namespace to avoid wrapping args in pr-str."
227233
{:arglists '([message & more] [throwable message & more])}
228234
[& args]
229235
`(logp :info ~@args))
230236

231237
(defmacro warn
232-
"Warn level logging using print-style args."
238+
"Warn level logging using print-style args.
239+
Use the 'logging.readable' namespace to avoid wrapping args in pr-str."
233240
{:arglists '([message & more] [throwable message & more])}
234241
[& args]
235242
`(logp :warn ~@args))
236243

237244
(defmacro error
238-
"Error level logging using print-style args."
245+
"Error level logging using print-style args.
246+
Use the 'logging.readable' namespace to avoid wrapping args in pr-str."
239247
{:arglists '([message & more] [throwable message & more])}
240248
[& args]
241249
`(logp :error ~@args))
242250

243251
(defmacro fatal
244-
"Fatal level logging using print-style args."
252+
"Fatal level logging using print-style args.
253+
Use the 'logging.readable' namespace to avoid wrapping args in pr-str."
245254
{:arglists '([message & more] [throwable message & more])}
246255
[& args]
247256
`(logp :fatal ~@args))
248257

249258
(defmacro tracef
250-
"Trace level logging using format."
259+
"Trace level logging using format.
260+
Use the 'logging.readable' namespace to avoid wrapping args in pr-str."
251261
{:arglists '([fmt & fmt-args] [throwable fmt & fmt-args])}
252262
[& args]
253263
`(logf :trace ~@args))
254264

255265
(defmacro debugf
256-
"Debug level logging using format."
266+
"Debug level logging using format.
267+
Use the 'logging.readable' namespace to avoid wrapping args in pr-str."
257268
{:arglists '([fmt & fmt-args] [throwable fmt & fmt-args])}
258269
[& args]
259270
`(logf :debug ~@args))
260271

261272
(defmacro infof
262-
"Info level logging using format."
273+
"Info level logging using format.
274+
Use the 'logging.readable' namespace to avoid wrapping args in pr-str."
263275
{:arglists '([fmt & fmt-args] [throwable fmt & fmt-args])}
264276
[& args]
265277
`(logf :info ~@args))
266278

267279
(defmacro warnf
268-
"Warn level logging using format."
280+
"Warn level logging using format.
281+
Use the 'logging.readable' namespace to avoid wrapping args in pr-str."
269282
{:arglists '([fmt & fmt-args] [throwable fmt & fmt-args])}
270283
[& args]
271284
`(logf :warn ~@args))
272285

273286
(defmacro errorf
274-
"Error level logging using format."
287+
"Error level logging using format.
288+
Use the 'logging.readable' namespace to avoid wrapping args in pr-str."
275289
{:arglists '([fmt & fmt-args] [throwable fmt & fmt-args])}
276290
[& args]
277291
`(logf :error ~@args))
278292

279293
(defmacro fatalf
280-
"Fatal level logging using format."
294+
"Fatal level logging using format.
295+
Use the 'logging.readable' namespace to avoid wrapping args in pr-str."
281296
{:arglists '([fmt & fmt-args] [throwable fmt & fmt-args])}
282297
[& args]
283298
`(logf :fatal ~@args))

0 commit comments

Comments
 (0)