CL-KOUTPUT

Common Lisp library based on "A System of Useful Output".

Download as .zip Download as .tar.gz View on GitHub

CL-KOUTPUT is a Lisp library for outputting message as described in "A System of Useful Output". The name is a shortened version of "kyle's output", as I couldn't really come up with a better name.

The library is fairly straightforward:

(info "This is an information message.")

would output

[+] This is an information message.

The syntax for all the forms is simple:

(defun level (message-string &optional (stream nil) &rest args)
  ...)

The basic message forms are:

Note that since the names error and debug are reserved by the CL ANSI standard, alternative names have been chosen.

You can change the default stream using set-default-stream:

(set-default-stream nil)

would set the default behaviour to return a string. You can use the -default forms to automatically use the default stream:

(info-default message-string foo bar baz)

would write the message string (which in this case assumed three "~A"s) to a string (assuming the previous set-default-stream invocation). For example,

CL-USER> (koutput:set-default-stream nil)
NIL
CL-USER> (koutput:info-default "Hello ~A" "kyle")
"[+] Hello kyle"

The functions reside under the 'koutput' package. If placed in the Quicklisp local projects directory, it can be loaded from Quicklisp:

(ql:quickload :cl-koutput)

and the functions accessed via the koutput package.