logger
(require logger) | package: logger |
Provides simple colored logging functionality of various log levels.
procedure
(logger-color state) → void?
state : (or/c 'automatic #t #f)
1 Basic Loggers
syntax
(trce expr ...)
> (logger-color #f) > (trce (+ 1 2)) (trce (+ 1 2) = 3)
3
No suffix prints the expression as well as its result
* suffix prints the result, and _ instead of the expression. Can only handle one argument
^ suffix is similar to * but also prints the date and source location
+ prints the date, source location, expression, and result. It is the most verbose suffix.
All loggers return their last input.
Besides trce, the following loggers are implemented: dbug info warn erro crit ftal. Accompanying suffixes apply.
syntax
(dbug expr ...)
syntax
(info expr ...)
syntax
(warn expr ...)
syntax
(erro expr ...)
syntax
(crit expr ...)
syntax
(ftal expr ...)
2 No-expression Loggers
syntax
(trce* expr)
syntax
(dbug* expr)
syntax
(info* expr)
syntax
(warn* expr)
syntax
(erro* expr)
syntax
(crit* expr)
syntax
(ftal* expr)
3 No-expression + Time/Source Loggers
syntax
(trce^ expr)
syntax
(dbug^ expr)
syntax
(info^ expr)
syntax
(warn^ expr)
syntax
(erro^ expr)
syntax
(crit^ expr)
syntax
(ftal^ expr)
4 Fully Verbose Loggers
syntax
(trce+ expr ...)
syntax
(dbug+ expr ...)
syntax
(info+ expr ...)
syntax
(warn+ expr ...)
syntax
(erro+ expr ...)
syntax
(crit+ expr ...)
syntax
(ftal+ expr ...)
5 Examples
> (dbug (+ 1 (sqr 2))) (dbug (+ 1 (sqr 2)) = 5)
5
> (trce* (+ 1 2)) (trce* _ = 3)
3
> (crit^ (number->string (+ 1 2))) (crit^ 2025-01-20T13:08:10 (unknown 5 0) _ = "3")
"3"
> (info+ `(connection-established ,8000))
(info+
2025-01-20T13:08:10
(unknown 6 0)
`(connection-established ,8000)
=
(connection-established 8000))
'(connection-established 8000)