/cambium

Demonstrate how to use the Cambium logging framework from Clojure

Primary LanguageClojureEclipse Public License 1.0EPL-1.0

Clojure Cambium Demo

A simple demo on how to use the Cambium logging library in Clojure projects

Verify you have Java, Clojure, and Leiningen set up correctly

Try the following commands, and make sure you get similar output:

> java --version
java 13 2019-09-17
Java(TM) SE Runtime Environment (build 13+33)
Java HotSpot(TM) 64-Bit Server VM (build 13+33, mixed mode, sharing)

> lein --version
Leiningen 2.9.1 on Java 13 Java HotSpot(TM) 64-Bit Server VM

View the source code

> cat src/clj/demo/core.clj

(ns demo.core
  (:use tupelo.core)
  (:require
    [cambium.core :as log]
    [schema.core :as s])
  (:gen-class))

...<snip>...

(defn -main
  "I don't do a whole lot ... yet."
  [& args]
  (log/info "-main - enter")

  (println "Hello, World! Again!")

  (log/info "-main - leave"))

So we see that cambium.core is required into the namespace , then used to log a message upon entry and exit of the main program.

Running with Cambium log output

> lein clean ; lein run

15:24:57.003 [main] INFO  demo.core - -main - enter { ns=demo.core, line=17, column=3 }
Hello, World! Again!
15:24:57.004 [main] INFO  demo.core - -main - leave { ns=demo.core, line=21, column=3 }

So we can see the logging statements are executed and print canonical results, with the output of the println statement sandwiched inbetween.

License

Copyright © 2022 Alan Thompson

Distributed under the Eclipse Public License, the same as Clojure.

Development Environment

Developed using IntelliJ IDEA with the Cursive Clojure plugin.

IntelliJ

Cursive

YourKit supports open source projects with its full-featured Java Profiler. YourKit, LLC is the creator of YourKit Java Profiler and YourKit .NET Profiler, innovative and intelligent tools for profiling Java and .NET applications.

YourKit