Next: (scriba scriba), Previous: (scriba json), Up: API
This module holds the plaintext layout shared by Scriba’s text backends (the console and the file logger). Fields are formatted as bracketed blocks and joined in the order requested by the logger’s ‘#:layout‘, so a backend only has to decide where the finished line goes.
Timestamps are cached per format string and per wall-clock second. Formatting a time is by far the most expensive part of a log line (it consults the timezone database), while a second-resolution format cannot change within the same second, so the cache removes that cost from every line but the first one of each second.
Returns VALUE rendered the way ‘display’ would render it.
Strings are returned untouched, so the common case allocates nothing.
Converts an alist context into a bracketed string layout: [k=v] [k=v].
Returns the formatted logger name, or an empty string.
Returns the current time formatted with FORMAT-STRING, without brackets.
The result is reused for every log line within the same second, because
strftime and localtime are much more expensive than the
rest of a log line and a second-resolution format cannot change faster
than that.
Converts an list of tags into a bracketed string layout: [#a #b #c].
Returns a formatted, bracketed timestamp string.
Returns a procedure that turns a log level into a logging procedure.
The returned procedure maps a level symbol (or #t for level-less messages) to a ‘(lambda (msg . args) ...)’ procedure. When called, that procedure formats MSG with ARGS, builds the configured LAYOUT and hands the finished line, without any newline, to EMIT. Backends use EMIT to choose their destination, newline placement and flushing behaviour.
Next: (scriba scriba), Previous: (scriba json), Up: API