Skip to content

Modern Log Fatal

Paul Squires edited this page Oct 19, 2026 · 6 revisions

Home › Logging › Logging › Fatal

Fatal

Logs a message at the most severe level, or returns a record; it does not end the program.

Syntax

Fatal( ) as LogEvent
Fatal( byref m as ustring )

Notes

  • The most severe level -- and it DOES NOT TERMINATE ANYTHING.
  • Two forms: the one taking a message logs immediately, and the no-argument one returns a LogEvent to hang fields on, committed by .Msg( ) or .Send( ).
  • An event that is never committed emits nothing -- the destructor does not auto-send, so a forgotten .Msg( ) shows up as a missing line rather than a line from nowhere.
  • Suppressed entirely when the logger's MinLevel is above LOG_FATAL, and Enabled( ) is how to skip building an expensive message.
  • LOG_FATAL is a severity, not an action: a library that logs it has not decided to end your process.

Examples

#import "std/logs"
using logs

dim con as ConsoleSink
dim lg as Logger
lg.AddSink( @con )

lg.Fatal( "a message, logged immediately" )

'' Or build a record with fields, committed by Msg( )
lg.Fatal( ).AddText( "user", "ada" ).AddInt( "attempt", 2 ).Msg( "with fields" )

'' Nothing is emitted by an event that is never committed
lg.Fatal( ).AddText( "user", "grace" )
print "done"

Library: Logging
Category: Logging
Documented under: Members

Clone this wiki locally