![]() |
JSBSim Flight Dynamics Model 1.3.0 (09 Apr 2026)
An Open Source Flight Dynamics and Control Software Library in C++
|
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.
#include <FGLog.h>
Inheritance diagram for FGLogger:Public Member Functions | |
| virtual | ~FGLogger () |
| Virtual destructor for polymorphic use. | |
| virtual void | FileLocation (const std::string &filename, int line) |
| Optionally provides source filename and line for contextual diagnostics. | |
| virtual void | Flush (void) |
| Ends the current log record and commits any buffered output. | |
| virtual void | Format (LogFormat format) |
| Applies a formatting hint to subsequent output. | |
| virtual void | Message (const std::string &message)=0 |
| Appends message text. May be called multiple times per log record. | |
| virtual void | SetLevel (LogLevel level) |
| Starts a new log record and provides its severity level. | |
Protected Attributes | |
| LogLevel | log_level = LogLevel::BULK |
|
inlinevirtual |
|
inlinevirtual |
Optionally provides source filename and line for contextual diagnostics.
Reimplemented in BufferLogger, and FGLogConsole.
Definition at line 132 of file FGLog.h.
|
inlinevirtual |
Ends the current log record and commits any buffered output.
Reimplemented in FGLogConsole.
Definition at line 138 of file FGLog.h.
|
inlinevirtual |
Applies a formatting hint to subsequent output.
Reimplemented in BufferLogger, and FGLogConsole.
Definition at line 136 of file FGLog.h.
|
pure virtual |
Appends message text. May be called multiple times per log record.
Implemented in BufferLogger, and FGLogConsole.
|
inlinevirtual |