Batteries-included logging for Clojure. You can require this one file and begin logging, with no further configuration necessary.
BUG - TODO: Fix so that (set-default-logger!) gets called automatically if the user tries to log without calling it first.
TODO: Add profiling methods (i.e. run a function and log how long it took)
Batteries-included logging for Clojure. You can require this one file and begin logging, with no further configuration necessary. BUG - TODO: Fix so that (set-default-logger!) gets called automatically if the user tries to log without calling it first. TODO: Add profiling methods (i.e. run a function and log how long it took)
(appender-for-file logfile)
Returns a FileAppender for the given file.
Returns a FileAppender for the given file.
(color colors & data)
ANSI colorizes the given data and returns it.
The first argument is a either a color specifier as per clansi.core, or a collection of color specifiers. For example, :white or [:bright :white] are valid
Subsequent arguments are concatenated into a string.
Examples:
(log/error (log/color [:bright :red] "foo")) (log/error (log/color :red "foo"))
ANSI colorizes the given data and returns it. The first argument is a either a color specifier as per clansi.core, or a collection of color specifiers. For example, :white or [:bright :white] are valid Subsequent arguments are concatenated into a string. Examples: (log/error (log/color [:bright :red] "foo")) (log/error (log/color :red "foo"))
(plus-logger logger-sym)
Defines a new logger function called by the given symbol name suffixed with a plus. This function copies forms given to it to STDERR in addition to logging them at the specified level.
For example, (plus-logger info) creates a function called info+. Calling (info+ "foo") is the same as calling (info "foo"), except that the message will be written to STDERR in addition to logged at the :info level.
Defines a new logger function called by the given symbol name suffixed with a plus. This function copies forms given to it to STDERR in addition to logging them at the specified level. For example, (plus-logger info) creates a function called info+. Calling (info+ "foo") is the same as calling (info "foo"), except that the message will be written to STDERR in addition to logged at the :info level.
(root-cause tr)
Returns the last 'cause' Throwable in a chain of Throwables. (From http://clojuredocs.org/clojure_core/clojure.stacktrace/root-cause)
Returns the last 'cause' Throwable in a chain of Throwables. (From http://clojuredocs.org/clojure_core/clojure.stacktrace/root-cause)
(set-default-logger! & args)
Deprecated old name for start!.
Deprecated old name for start!.
(set-log-level! level)
Sets the global log level to the given level. Levels are keywords
Sets the global log level to the given level. Levels are keywords - :debug, :info, :warn, etc.
(set-namespace-logger! logfile)
(set-namespace-logger! ns log-level log-adapter)
(spy & forms)
Evaluates the given forms, logs their result at debug level, and then returns their result. You can then take a given form and insert a (spy (foo)) around it to trace its operation.
Evaluates the given forms, logs their result at debug level, and then returns their result. You can then take a given form and insert a (spy (foo)) around it to trace its operation.
(spy+ & forms)
Like spy, but copies messages to STDERR in addition to logging them.
Like spy, but copies messages to STDERR in addition to logging them.
(stacktrace throwable)
Converts a Throwable into a sequence of strings with the stacktrace.
Converts a Throwable into a sequence of strings with the stacktrace.
(start!)
(start! logfile)
(start! logfile loglevel)
(start! logfile loglevel force)
Sets a default, appwide log adapter. Optional arguments set the default logfile and loglevel. If no logfile is provided, logs to log/clojure.log from the current working directory.
If 'initialized' is true, does nothing unless 'force' is true. This is so that multiple libraries can all call this in the same project and share the same logfile, while each also specifying a default logfile for itself when used separately.
Sets a default, appwide log adapter. Optional arguments set the default logfile and loglevel. If no logfile is provided, logs to log/clojure.log from the current working directory. If 'initialized' is true, does nothing unless 'force' is true. This is so that multiple libraries can all call this in the same project and share the same logfile, while each also specifying a default logfile for itself when used separately.
(throwable tr)
Renders a single Throwable into string form. Includes the class name, message, and the stacktrace.
If there is a chain of causes present, also logs the root cause.
Renders a single Throwable into string form. Includes the class name, message, and the stacktrace. If there is a chain of causes present, also logs the root cause.
(with-console & forms)
Executes the given code block with all log messages copied to STDOUT in addition to logging them.
Executes the given code block with all log messages copied to STDOUT in addition to logging them.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close