D.A.B.Tv0.0.33 Tutorial API DABT Tools ↗ GitHub ↗

tui.log

tui.log MSG [LEVEL]

Appends a line to the app’s log file. stdout is the screen, so logs go to a file.

Parameters

  • MSG: the message.
  • LEVEL: debug, info, warn or error; shown in brackets. Any other text counts as info for the filter and is shown as written. Default: info.

Output: nothing on screen. The file gets [HH:MM:SS] [LEVEL] MSG, unless LEVEL is below the log level (tui.log.level, default info): then nothing is written.

Notes

  • The file is ~/.config/DABT/apps/<TUI_APP_NAME>/logs/<yyyy-mm-dd>_<TUI_APP_NAME>.log (dabt when no app name is set). Set TUI_LOG_DIR before sourcing tui.sh to use another folder. tui.log.file prints the current path.
  • One file per day; an app running past midnight continues in the next day’s file.
  • Fork-free once the folder exists. A log folder that can’t be created or written is ignored silently; logging never fails the caller.
  • Logs are never rotated or deleted.

Example

tui.log "export started: $file"
tui.log.warn "config missing, using defaults"

See also: tui.log.level, tui.log.debug, tui.log.info, tui.log.warn, tui.log.error