Simple Logging API

The Simple Logging API is designed so that there are only three functions (actually macros) that you use. It is still somewhat configurable, though not to the same degree as the NormalLoggingApi

Types

  • T/SIMPLE-LOG-TYPE: A keyword that is one of: :INFO, :ERROR, or :WARN.

Globals

These are the various special variables that will influence how the Simple Logging API functions.

* SIMPLE-HEADER/INFO: The header for info messages printed using the Simple Logging API. Default: "Info".

* SIMPLE-HEADER/WARN: The header for warning messages printed using the Simple Logging API. Default: "Warning".

* SIMPLE-HEADER/ERROR: The header for error messages printed using the Simple Logging API. Default: "Error".

* SIMPLE-COLOR/INFO: The color of the header for info messages printed using the Simple Logging API. Default: :CYAN.

* SIMPLE-COLOR/WARN: The color of the header for warning messages printed using the Simple Logging API. Default: :YELLOW.

* SIMPLE-COLOR/ERROR: The color of the header for error messages printed using the Simple Logging API. Default: :RED.

* SIMPLE-STREAM/INFO: The stream to write info messages when using the Simple Logging API. Default: STANDARD-OUTPUT

* SIMPLE-STREAM/WARN: The stream to write warning messages when using the Simple Logging API. Default: ERROR-OUTPUT

* SIMPLE-STREAM/ERROR: The stream to error warning messages when using the Simple Logging API. Default: ERROR-OUTPUT

* SIMPLE/NO-COLOR: When non-NIL, do not use ANSI color sequences when logging with the Simple Logging API. This will cause the various SIMPLE-COLOR/ variables to be ignored. Default: NIL.

* FORCE-OUTPUT: When non-NIL, FORCE-OUTPUT will be called after each logging call. NOTE: this also affects the NormalLoggingApi.

The various -COLOR/ variables should be of type P36:T/ANSI-SIMPLE-COLOR, as defined in the P36-LIB package.

Simple API Logging Macros

[Macro]
SINFO msg &rest fmt-args

Writes the *SIMPLE-HEADER/INFO* string in brackets, followed by a colon and space, and then formats MSG with FMT-ARGS to *SIMPLE-STREAM/INFO*. The header is colored with *SIMPLE-COLOR/INFO* unless *SIMPLE/NO-COLOR* is NIL.

The resulting output will look like this (assuming the default header):

  [Info]: <your message>

[Macro]
SWARN msg &rest fmt-args

Writes the *SIMPLE-HEADER/WARN* string in brackets, followed by a colon and space, and then formats MSG with FMT-ARGS to *SIMPLE-STREAM/WARN*. The header is colored with *SIMPLE-COLOR/WARN* unless *SIMPLE/NO-COLOR* is NIL.

The resulting output will look like this (assuming the default header):

  [Warning]: <your message>

[Macro]
SERROR msg &rest fmt-args

Writes the *SIMPLE-HEADER/ERROR* string in brackets, followed by a colon and space, and then formats MSG with FMT-ARGS to *SIMPLE-STREAM/ERROR*. The header is colored with *SIMPLE-COLOR/ERROR* unless *SIMPLE/NO-COLOR* is NIL.

The resulting output will look like this (assuming the default header):

  [Error]: <your message>