ClojureScript console logging macros.
[adzerk/cljs-console "0.1.1"] ;; latest release
(ns foo
(:require [adzerk.cljs-console :as log :include-macros true]))
CLJS_LOG_LEVEL={DEBUG|INFO|WARN|ERROR|NONE}
String interpolation is used to generate formatted log messages. The
interpolated form or expression is delimited by a control character followed by
{}
for atoms or ()
for expressions.
Char | Format | Mnemonic | Example |
---|---|---|---|
~ | %s | Clojure unquote | "data: ~(:data x)" |
# | %d | ints are numbers | "found #{count} things" |
. | %f | floats have points | "money = $.{amount}" |
' | %s | strings are quoted | "hello, '(:name person)" |
< | %o | xml has <> | "doc: <{js/document}" |
@ | %O | looks like big-O | "status: @{some-js-obj}" |
^ | %c | nobody uses this | "^{css-format}hi there" |
;; clear the console log
(clear)
;; print to the console
(debug message)
(info message)
(warn message)
(error message)
;; group log messages
(group+ message & body) ; expanded
(group- message & body) ; collapsed
;; drop into the js debugger
(debugger)
;; log error if expression isn't truthy
(log-assert expression message)
;; count how many times it's called
(log-count label)
;; engage js profiling engine
(profile-start label)
(profile-end label)
(with-profile label & body)
;; record a time interval
(time-start label)
(time-end label)
(with-time label & body)
;; mark the timeline
(timestamp), (timestamp label)
;; get a stack trace
(trace object & objects)
;; inline inspection of values
(spy-> form), (spy-> form message)
(spy->> form), (spy->> message form)
# build and install locally
boot build-jar
# push snapshot
boot build-jar push-snapshot
# push release
boot build-jar push-release
Copyright © 2015 Adzerk
Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close