Expand description
Rotating, redacted log file shared by the host, the interface, and widgets.
Records go through the log facade. Toolbloxβs own records are kept from Info up (Debug
in debug builds); other crates, such as Tauri and its plugins, from Warn up. Every line is
redacted before itβs written, so cookies, tickets, authorization headers, and launch URLs never
reach the file, whoever logged them.
The file is logs/toolblox.log in the data folder. It rotates at 1 MB and keeps three older
files, toolblox.log.1 through toolblox.log.3.
StructsΒ§
- File
Logger π - Appends records to the current file, rotating it when it grows too large.
ConstantsΒ§
- BACKUPS π
- Rotated files kept next to the current one.
- CRATE_
PREFIX π - Prefix of Toolbloxβs own module paths, dropped from record targets.
- CRATE_
ROOT π - Target of records logged from the crate root, shown as
toolblox. - FILE_
NAME π - Name of the current log file.
- LAUNCH_
SCHEMES π - Schemes whose URIs carry join tickets. Everything after the scheme is redacted.
- MAX_
FILE_ πBYTES - Size at which the current file rotates.
- MAX_
MESSAGE_ BYTES - Longest message kept per record, in bytes. Longer messages are cut.
- MAX_
TAIL_ LINES - Most lines
tailreturns when given a count. - OWN_
TARGETS - Targets for records that donβt come from a Toolblox module.
- REDACTED π
- Replacement for redacted values.
- SECRET_
KEYS π - Keys whose values are secret wherever they appear as
key=value,key: value, or"key": "value". Matched case-insensitively at word boundaries. - WHOLE_
VALUE_ πKEYS - Keys whose values run to the end of the line or quote, because they can contain spaces or
several
name=valuepairs. - WIDGET_
TARGET_ PREFIX - Prefix of widget record targets, followed by the widget ID.
StaticsΒ§
- LOGGER π
FunctionsΒ§
- civil_
from_ πdays - Converts days since 1970-01-01 to a proleptic Gregorian date (Howard Hinnantβs algorithm).
- directory
- Folder holding the log files, once logging has started.
- format_
line π - Formats one record as a redacted line:
<UTC time> <LEVEL> <target>: <message>. - init
- Starts logging to
directoryand records panics. Later calls do nothing. - is_
word_ πbyte - level_
for π - Highest level kept for a target.
- open π
- Opens the log file for appending, creating it if needed.
- redact
- Replaces Roblox session cookies, launch URIs, and the values of
SECRET_KEYSwith[redacted]. - rotate π
- Shifts
toolblox.log.NtoN + 1, dropping the oldest, then moves the current file to.1. - sanitize π
- Escapes control characters. With
multiline, line breaks become indented continuation lines. - secret_
at π - Finds a secret starting at
indexand returns the byte range of its value. - skip_
spaces π - tail
- Returns up to
linesof the most recent log lines, oldest first, reading into rotated files when the current one is shorter.Nonereturns every line of every file. - tail_in π
- timestamp π
- Formats a time as UTC ISO 8601 with milliseconds.
- value_
end π - End of an unquoted value: the next whitespace, quote, or separator. With
whole, only line breaks and quotes end it.