17 Logging utilities
This module adds some useful features to the core logging functionality of PLT Scheme:
an application log to which application-level messages may be logged (several Untyped libraries write to this log);
application log messages can be timestamped;
standard debugging information can be included in application log messages;
special application logging macros are provided that allow multiple arguments of any type.
Application log messages are not reported until a call is made to start-log-output, or until a call is made to log-receiver.
Adds a fatal error message to the application log. The arguments are formatted them into a single-line log message together with the message level and current time. The time is returned as a SRFI 19 time-utc?.
Adds a non-fatal error message to the application log. Behaviour is similar to that of log-fatal*.
Adds a warning message to the application log. Behaviour is similar to that of log-fatal*.
Adds an informational message to the application log. Behaviour is similar to that of log-fatal*.
Adds a debugging message to the application log. Behaviour is similar to that of log-fatal*.
|(start-log-output level [handler]) → (-> void?)|
| level : (U 'fatal 'error 'warning 'info 'debug)|
| handler : handler-procedure = default-log-handler|
Starts a thread that handles application lof messages of the specified level or above. Returns a thunk that stops the logging thread and terminates output.
handler is called each time a message is logged, and should accept three arguments:
the level of the message (U 'fatal 'error 'warning 'info 'debug);
the message to log (a string);
the continuation marks at the point of log entry (a continuation-mark-set).
is omitted, a default-handler-procedure
is used that prints all messages to the current-output-port
| → (log-level time-utc? list? -> string?)|
|(current-log-formatter formatter) → void?|
| formatter : (log-level time-utc? list? -> string?)|
Parameter that customises the formatting of application log messages. The value must be a procedure that takes three arguments:
the log level ('fatal, 'error, 'warning, 'info or 'debug);
an entry timestamp (encoded as a SRFI 19 time-utc?);
the list of the arguments passed to the logging macro (log-fatal* or equivalent).