This commit is contained in:
2026-04-09 14:07:47 +02:00
parent 83723d1cc8
commit 08c53184eb
2 changed files with 9 additions and 9 deletions

View File

@@ -159,7 +159,7 @@
(define-syntax (sl-def-log stx) (define-syntax (sl-def-log stx)
(syntax-case stx (log-callbacks) (syntax-case stx (log-callbacks)
((_ id parent prefix) ((_ id prefix parent)
(with-syntax ([receiver (format-id #'id "receiver-~a" #'prefix)] (with-syntax ([receiver (format-id #'id "receiver-~a" #'prefix)]
[dbg-name (format-id #'id "dbg-~a" #'prefix)] [dbg-name (format-id #'id "dbg-~a" #'prefix)]
[info-name (format-id #'id "info-~a" #'prefix)] [info-name (format-id #'id "info-~a" #'prefix)]
@@ -170,11 +170,11 @@
#'(def-log2 id parent receiver log-callbacks dbg-name info-name warn-name err-name fatal-name) #'(def-log2 id parent receiver log-callbacks dbg-name info-name warn-name err-name fatal-name)
) )
) )
((_ id parent) ((_ id name)
#'(sl-def-log id parent id) #'(sl-def-log id name #f)
) )
((_ id) ((_ id)
#'(sl-def-log id #f id) #'(sl-def-log id id #f)
) )
) )
) )

View File

@@ -15,8 +15,8 @@ registered callbacks.
@defmodule["simple-log"] @defmodule["simple-log"]
@defform*[((sl-def-log id) @defform*[((sl-def-log id)
(sl-def-log id parent) (sl-def-log id name)
(sl-def-log id parent prefix))]{ (sl-def-log id name parent))]{
Defines a logger with topic @racket['id] and creates: Defines a logger with topic @racket['id] and creates:
@@ -28,7 +28,7 @@ Defines a logger with topic @racket['id] and creates:
@item{@racket[fatal-id]} @item{@racket[fatal-id]}
] ]
Note. If prefix is given, id @racket[dbg-prefix], etc. will be generated instead of @racket[dbg-id], etc. Note. If name is given, id @racket[dbg-prefix], etc. will be generated instead of @racket[dbg-id], etc.
Each procedure has shape: Each procedure has shape:
@@ -39,7 +39,7 @@ Each procedure has shape:
The message is formatted via @racket[format] and emitted with a timestamp The message is formatted via @racket[format] and emitted with a timestamp
(@litchar{YYYY-MM-DDTHH:MM:SS}) and topic @racket['id]. (@litchar{YYYY-MM-DDTHH:MM:SS}) and topic @racket['id].
If @racket[parent] is omitted, the current logger is used. If @racket[parent] is omitted, the @racket[#f] is used as "parent logger".
A background thread is started that receives log events and forwards them A background thread is started that receives log events and forwards them
to the registered callbacks. to the registered callbacks.
@@ -151,4 +151,4 @@ creates:
@defproc[#:link-target? #f @defproc[#:link-target? #f
(fatal-my-module [msg string?] [arg any/c] ...) void?]{Fatal log.} (fatal-my-module [msg string?] [arg any/c] ...) void?]{Fatal log.}
All use @racket[format] and emit asynchronously. All use @racket[format] and emit asynchronously.