2026-08-30 09:28:58 +02:00
2026-08-30 09:28:58 +02:00
2026-08-30 09:28:58 +02:00
2026-04-20 16:26:06 +02:00
2026-08-30 09:28:58 +02:00
2026-04-08 21:22:16 +02:00
2026-08-30 09:28:58 +02:00
-
2026-04-09 10:10:28 +02:00
2026-08-30 09:28:58 +02:00

simple-log

simple-log is a small convenience layer on top of Racket's logging system. It provides generated procedures for the standard log levels and supports logging to the display, regular or daily rotating files, custom callbacks, and a filterable in-memory store.

#lang racket

(require simple-log)

(sl-def-log example)
(define logs (sl-log-to-store 1000))
(sl-log-to-display)

(info-example "Started with ~a items" 3)
(warn-example "An example warning")
(sync-log-example)

(sl-store->display
 (sl-store-grep-level logs 'warning))

Topic filters can select multiple topics or invert a match:

(sl-store-grep-topic logs '(webview webview-backend))
(sl-store-grep-topic logs 'webview-backend #:invert? #t)

The Scribble manual documents logger definitions, destinations, log levels, synchronization, and all in-memory store operations.

Rotating log files

Daily rotation keeps the current log as plain text and gzip-compresses older days. The retention value counts the current day as well.

(sl-log-to-rotating-file "application.log")      ; 7 days
(sl-log-to-rotating-file "application.log" 14)   ; 14 days

With a retention of 7 days the files look like this:

application.log
application.log.2026-08-28.gz
application.log.2026-08-27.gz
...
S
Description
Extends on racket logging to make it more simple
Readme Apache-2.0 512 KiB
Languages
Racket 99.5%
Makefile 0.5%