5.92
15 Logging
This library is unstable;
compatibility will not be maintained.
See Unstable: May Change Without Warning
for more information.
(require unstable/logging) | package: typed-racket-lib |
This module provides tools for logging.
procedure
(with-logging-to-port port proc log-spec ...) → any
port : output-port? proc : (-> any) log-spec : (or/c 'fatal 'error 'warning 'info 'debug symbol? #f)
Runs proc, outputting any logging that would be received by
(make-log-receiver (current-logger) log-spec ...) to port.
Returns whatever proc returns.
Example: | |||||||||
|
procedure
(with-intercepted-logging interceptor proc log-spec ...) → any
interceptor :
(-> (vector/c (or/c 'fatal 'error 'warning 'info 'debug) string? any/c (or/c symbol? #f)) any) proc : (-> any) log-spec : (or/c 'fatal 'error 'warning 'info 'debug symbol? #f)
Runs proc, calling interceptor on any log message that would
be received by (make-log-receiver (current-logger) log-spec ...).
interceptor receives the entire log vectors
(see Receiving Logged Events)
as arguments. Returns whatever proc returns.
Example: | ||||||||||||||
|
A lower-level interface to logging is also available.
procedure
(start-recording log-spec ...) → listener?
log-spec : (or/c 'fatal 'error 'warning 'info 'debug symbol? #f)
procedure
(stop-recording listener)
→
(listof (vector/c (or/c 'fatal 'error 'warning 'info 'debug) string? any/c (or/c symbol? #f))) listener : listener?
start-recording starts recording log messages matching the given
log-spec (see make-log-receiver for how log-spec is
interpreted). Messages will be recorded until stopped by passing the returned
listener object to stop-recording. stop-recording will then
return a list of the log messages that have been reported.
Examples: | |||||||||||||||
|