Liking cljdoc? Tell your friends :D

cartus

Clojars Project Clojars Downloads GitHub Contributors

A structured logging abstraction for logging data rich events with support for multiple backends, currently including:

  • a test logger for collecting logs in memory and asserting against them; and
  • a cambium logger for logging out via SLF4J and logback.
  • a null logger that ignores all logged events, useful as a default implementation or to turn off logging completely.

Heavily inspired by JUXT's blog post on logging.

Installation

Add the following to your project.clj file:

[io.logicblocks/cartus.core "0.1.16"]

Depending on which backends you plan to use, add one or more of the following to your project.clj file:

[io.logicblocks/cartus.null "0.1.16"]
[io.logicblocks/cartus.test "0.1.16"]
[io.logicblocks/cartus.cambium "0.1.16"]

The cambium backend requires further configuration. See the Getting Started guide for more details.

Documentation

Usage

(require '[cartus.core :as log])
(require '[cartus.cambium])

(cartus.cambium/initialise)

(def logger (cartus.cambium/logger))

(log/info logger ::usage.demonstrated
  {:feature-coverage "3%" :customer-satisfaction :low})
(let [logger (log/with-context logger
               {:see "getting started guide" :for "more information"})]
  (log/debug logger ::usage.redirecting {:to "API docs"})
  (log/error logger ::usage.irritating
    {:joke "running thin"}
    {:exception (ex-info "Not funny!" {:stick-to "day job"})}))

License

Copyright © 2022 LogicBlocks Maintainers

Distributed under the terms of the MIT License.

Can you improve this documentation? These fine people already did:
Circle CI & Toby Clemson
Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close