FGLogger¶
- class jsbsim.FGLogger¶
Logging backend interface.
JSBSim routes each log record to an FGLogger instance instead of writing directly to stdout/stderr. Applications can keep the default FGLogConsole backend, or provide their own subclass and register it through SetLogger(FGLogger_ptr) .
A single log record follows this lifecycle:
SetLevel() starts a new log record and gives the severity.
FileLocation() may be called (typically for XML-related messages), immediately after SetLevel() and before message content.
Message() receives the textual payload. It can be invoked multiple times for one logical record because JSBSim may build a message in fragments.
Format() communicates formatting intent (colors, emphasis, reset) for the subsequent output. Implementations may ignore it if formatting is not applicable.
Flush() ends the current log record and is the right place to finalize and emit the record (for example: prefixing, buffering, forwarding to a UI, or forcing output synchronization).
Implementations are expected to keep enough internal state between these callbacks to assemble one coherent log record.
- file_location(filename: str, line: int) None¶
Optionally provides source filename and line for contextual diagnostics.
- flush() None¶
Ends the current log record and commits any buffered output.
- message(message: str) None¶
Appends message text. May be called multiple times per log record.
- class jsbsim.DefaultLogger¶
Default logger: print messages to stdout without formatting.
- file_location(filename: str, line: int) None¶
Optionally provides source filename and line for contextual diagnostics.
- message(message: str) None¶
Appends message text. May be called multiple times per log record.