Common Lisp Package: LOGV

README:

FUNCTION

Public

FORMAT-LOG (FMT-STRING &REST FMT-ARGS)

calls WRITE-STRING-TO-LOG with the string created by combining `FMT-STRING' with `FMT-ARGS' like FORMAT and prepending the result with all the necessary informative garbage the following code: (format-log "foo bar ~A" 'baz) might result in the following line being sent to WRITE-STRING-TO-LOG: ;[repl-thread] [01:06:2008] [13:53:27] foo bar BAZ see also: *LOG-PREFIX-STRING*, *LOG-THREAD-NAME-P*, *LOG-DATE-P*, and *LOG-TIME-P*

WRITE-STRING-TO-LOG (STRING)

if *LOG-OUTPUT* is -a stream: writes `STRING' to *LOG-OUTPUT* -T: writes `STRING' to *STANDARD-OUTPUT* -NIL: doesn't do anything -a pathname designator: writes `STRING' to the file designated by *LOG-OUTPUT*

Private

.FORMAT-LOG-DATE (UT)

writes the date like "[DD:MM:YYY] " for FORMAT-LOG

.FORMAT-LOG-TIME (TIME)

writes the time like "[HH:MM:SS] " for FORMAT-LOG

.FORMAT-THREAD-NAME

writes the name of the thread like "[thread-name] " for FORMAT-LOG

MACRO

Public

LOGV (FORM &REST MORE-FORMS)

behaves like PROGN except it logs its forms and their return values using FORMAT-LOG. [and of course its forms are not reckognized by the compiler as being top-level forms because it's not a special operator like PROGN] the following code: (logv (+ 1 2) (+ 1 (logv (+ 1 1)))) will return 3 and probably result in something like the following lines being sent to WRITE-STRING-TO-LOG: ;[repl-thread] [01:06:2008] [14:07:53] (+ 1 2) -> 3 ;[repl-thread] [01:06:2008] [14:07:53] (+ 1 1) -> 2 ;[repl-thread] [01:06:2008] [14:07:53] (+ 1 (LOGV (+ 1 1))) -> 3 see also: FORMAT-LOG, LOGVS

LOGVS (FORM &REST MORE-FORMS)

lke LOGV but works with multiple return values

VARIABLE

Public

*LOG-DATE-P*

set to NIL if you don't want FORMAT-LOG to log the current date

*LOG-OUTPUT*

see WRITE-STRING-TO-LOG

*LOG-PREFIX-STRING*

the leftmost string prepended to the string sent to WRITE-STRING-TO-LOG-FILE by FORMAT-LOG

*LOG-THREAD-NAME-P*

set to NIL if you don't want FORMAT-LOG to log the name of the current

*LOG-TIME-P*

set to NIL if you don't want FORMAT-LOG to log the current time

Private

*LOG-MUTEX%*

prevents multiple threads from writing to *LOG-OUTPUT* at the same time