8.18
top
← prev up next →

loggerπŸ”— i

Kevin Robert Stravers

(require logger ) package: logger

Provides simple colored logging functionality of various log levels.

procedure

( logger-color state)void?

state:(or/c'automatic#t#f)
Sets the logger color.

1Basic LoggersπŸ”— i

syntax

( trce expr...)

Prints the expression in its code-form as well as the result of evaluating the expression.

Examples:
> (logger-color #f)
> (trce (+ 12))

(trce (+ 1 2) = 3)

3

A logger can be suffixed by a symbol. What follows is a list of applicable symbols:
  • 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...)

Forms of the default logger. Prints both syntax and the result of an evaluation. Logs a separate line for each expression.

2No-expression LoggersπŸ”— i

syntax

( trce* expr)

syntax

( dbug* expr)

syntax

( info* expr)

syntax

( warn* expr)

syntax

( erro* expr)

syntax

( crit* expr)

syntax

( ftal* expr)

Forms of the succinct logger. Prints only the result of an evaluation. Logs a separate line for each expression.

3No-expression + Time/Source LoggersπŸ”— i

syntax

( trce^ expr)

syntax

( dbug^ expr)

syntax

( info^ expr)

syntax

( warn^ expr)

syntax

( erro^ expr)

syntax

( crit^ expr)

syntax

( ftal^ expr)

Forms of the source-succinct logger. Prints the time, source file, line, and the result of an evaluation.

4Fully Verbose LoggersπŸ”— i

syntax

( trce+ expr...)

syntax

( dbug+ expr...)

syntax

( info+ expr...)

syntax

( warn+ expr...)

syntax

( erro+ expr...)

syntax

( crit+ expr...)

syntax

( ftal+ expr...)

Forms of the source-verbose logger. Prints the time, source file, line, expression, and the result of an evaluation.

5ExamplesπŸ”— i

Here are some examples of the loggers.

Examples:
> (dbug (+ 1(sqr2)))

(dbug (+ 1 (sqr 2)) = 5)

5

> (trce* (+ 12))

(trce* _ = 3)

3

> (crit^ (number->string (+ 12)))

(crit^ 2025εΉ΄08月18ζ—₯T03:22:43 (unknown 5 0) _ = "3")

"3"

> (info+ `(connection-established,8000))

(info+

2025εΉ΄08月18ζ—₯T03:22:43

(unknown 6 0)

`(connection-established ,8000)

=

(connection-established 8000))

'(connection-established8000)

top
← prev up next →

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /