46#include "simgear/misc/sg_path.hxx"
48#include "math/FGColumnVector3.h"
60using setprecision_t =
decltype(std::setprecision(0));
63using setw_t =
decltype(std::setw(0));
130 virtual void SetLevel(LogLevel level) { log_level = level;}
134 virtual void Message(
const std::string& message) = 0;
140 LogLevel log_level = LogLevel::BULK;
143using FGLogger_ptr = std::shared_ptr<FGLogger>;
154JSBSIM_API
void SetLogger(FGLogger_ptr logger);
174 template<typename T, typename = std::enable_if_t<std::is_arithmetic<T>::value>>
176 FGLogging&
operator<<(std::ostream& (*manipulator)(std::ostream&)) { buffer << manipulator;
return *
this; }
177 FGLogging&
operator<<(std::ios_base& (*manipulator)(std::ios_base&)) { buffer << manipulator;
return *
this; }
187 std::streambuf* rdbuf() {
return buffer.rdbuf(); }
193 std::ostringstream buffer;
205 void SetMinLevel(LogLevel level) { min_level = level; }
207 { buffer.append(
"\nIn file " + filename +
": line " + std::to_string(line) +
"\n"); }
208 void Message(
const std::string& message)
override { buffer.append(message); }
209 void Format(LogFormat format)
override;
210 void Flush(
void)
override;
215 LogLevel min_level = LogLevel::BULK;
223 const char* what()
const noexcept override;
This class implements a 3 element column vector.
void Message(const std::string &message) override
Appends message text. May be called multiple times per log record.
void FileLocation(const std::string &filename, int line) override
Optionally provides source filename and line for contextual diagnostics.
Logging backend interface.
virtual void FileLocation(const std::string &filename, int line)
Optionally provides source filename and line for contextual diagnostics.
virtual void SetLevel(LogLevel level)
Starts a new log record and provides its severity level.
virtual void Message(const std::string &message)=0
Appends message text. May be called multiple times per log record.
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 ~FGLogger()
Virtual destructor for polymorphic use.
Main namespace for the JSBSim Flight Dynamics Model.
FGLogger_ptr GetLogger(void)
Returns the active logger for the current thread.
ostream & operator<<(ostream &os, const FGColumnVector3 &col)
Write vector to a stream.
void SetLogger(FGLogger_ptr logger)
Sets the active logger for the current thread.