Guides/File logging

File logging

A running Program owns stdout, so print() corrupts the rendered UI. Write diagnostics to a file with FileLog and tail -f it in another terminal.

file logging · dart_tui
File logging demo
dart
final log = FileLog('debug.log');
log('got message: $msg');

// on shutdown:
await log.close();
FileLog.none() returns a logger that silently discards everything — handy for toggling diagnostics off without changing call sites.

Related