Liking cljdoc? Tell your friends :D

logger

Minimal Clojure logging library, mainly for scripting

Why?

There are quite a few logging libraries already available, so why another one? Some goals:

  • Log both to a file and to the console (stdout for now)
  • Include timestamps with both milliseconds and timezone
  • No config files needed
  • Keep it simple, mostly for command line scripts
  • Support multiple log files, e.g. server/daemon and client/script logs.

Installation

Leiningen/Boot

[ndevreeze/logger "0.3.0"]

Clojure CLI/deps.edn

ndevreeze/logger {:mvn/version "0.3.0"}

Clojars Project

Usage

Require:

(ns my.namespace
  (:require [ndevreeze.logger :as log]))

Initialise the logger:

(log/init "/tmp/foo.log" :info)

or:

(log/init nil :debug)

Then log at different levels:

(log/error "A different logfile, error level")
(log/warn "warn level")
(log/debug "One line at debug level")
(log/info "At info level")

Developing

Testing

$ lein midje

or:

$ lein repl (or start in Cider)
(use 'midje.repl)
(autotest)

Bugs

  • No known errors, but see Todo below. Use Github issues if you want to report a bug.

Todo

  • Should use Log4j v2, now using v1.

Related and similar projects (libraries)

License

Copyright © 2020, 2021 Nico de Vreeze

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

Can you improve this documentation?Edit on GitHub

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

× close