Overview Clamps Packages CM Dictionary Clamps Dictionary Fomus
Next: The Sly Debugger , Previous: Code Inspection , Up: Tools , Home: Introduction

Clamps Overview

Debugging Tools

Logging

To obtain information about the state of the program while it is running, Incudine implements a logging mechanism which is imported into clamps. Messages can be formatted to the REPL using the msg function. The first argument to that function is the logger level.

There are 4 available logger levels, :error, :warn, :info and :debug in ascending order. The currently active logger level can be returned or set using the logger-level function.

If a msg command uses a logger level <= the current logger level, it will be printed in the REPL, otherwise the msg command doesn't produce any output:

(logger-level) ; => :warn

(msg :warn "Warning") ; => nil

;; Output in the REPL:
;; warn: Warning

(msg :error "Error") ; => nil
;; Output in the REPL:
;; error: Error

(msg :info "Info") ; => nil
;; No Output in the REPL!

(setf (logger-level) :info) ; => :info
(msg :info "Info") ; => nil
;; Output in the REPL:
;; Info

(msg :error "Error") ; => nil
;; Output in the REPL:
;; error: Error

This mechanism can be used to put messaging into the code which is only activated for certain logger levels to be able to trace and inspect what is going on in the application by setting the appropriate logger level. In addition output can be directed by setting the *​logger-stream​* special variable.