58 #define LOGGER(level) \
59 _log->Cout(level) << log_level_name(level) << " " << __FILE__ << ":" \
60 << __LINE__ << " " << __FUNC_NAME__ << "(): "
63 #define LOGDBG _log->Cout(MOORDYN_DBG_LEVEL)
65 #define LOGMSG _log->Cout(MOORDYN_MSG_LEVEL)
67 #define LOGWRN LOGGER(MOORDYN_WRN_LEVEL)
69 #define LOGERR LOGGER(MOORDYN_ERR_LEVEL)
98 void SetFile(
const char* file_path);
180 inline void SetVerbosity(
const int verbosity) { _verbosity = verbosity; }
190 inline void SetLogLevel(
const int level) { _file_verbosity = level; }
195 const char* GetFile()
const;
206 void SetFile(
const char* file_path);
#define DECLDIR
Prefix to export C functions on the compiled library.
Definition: MoorDynAPI.h:68
A Logging utility.
Definition: Log.hpp:149
void SetVerbosity(const int verbosity)
Set the verbosity level.
Definition: Log.hpp:180
int GetLogLevel() const
Get the log file printing level.
Definition: Log.hpp:185
void SetLogLevel(const int level)
Set the log file printing level.
Definition: Log.hpp:190
int GetVerbosity() const
Get the verbosity level.
Definition: Log.hpp:175
A helper for the entities to use the logger.
Definition: Log.hpp:223
void SetLogger(Log *log)
Set the log handler.
Definition: Log.hpp:243
LogUser(Log *log=NULL)
Constructor.
Definition: Log.hpp:231
Log * GetLogger() const
Get the log handler.
Definition: Log.hpp:248
~LogUser()
Destructor.
Definition: Log.hpp:238
Log * _log
The log handler.
Definition: Log.hpp:252
Streamer able to redirect the output to several substreams.
Definition: Log.hpp:79
~MultiStream()
Destructor.
Definition: Log.cpp:85
MultiStream()
Constructor.
Definition: Log.cpp:78
std::ostream * _terminal
The terminal active streamer.
Definition: Log.hpp:127
const char * GetFile() const
Get the output file path.
Definition: Log.hpp:89
void SetTerminal(std::ostream &stream)
Set the terminal streamer.
Definition: Log.hpp:108
std::ofstream _fout
The output file streamer.
Definition: Log.hpp:123
void SetFile(bool enable=true)
Enable/disable the file printing.
Definition: Log.hpp:103
std::string _fpath
The file path.
Definition: Log.hpp:121
bool _fout_enabled
Flag to know if the file output is enabled.
Definition: Log.hpp:125
void SetFile(const char *file_path)
Set the output file path.
Definition: Log.cpp:92
MultiStream & operator<<(std::ostream &(*pfun)(std::ostream &))
Functionality for std::endl alike operators.
Definition: Log.hpp:112
#define MOORDYN_DBG_LEVEL
Debug message.
Definition: MoorDynAPI.h:126
#define MOORDYN_MSG_LEVEL
Info message.
Definition: MoorDynAPI.h:124
MoorDyn2 C++ API namespace.
Definition: Body.cpp:27
std::string log_level_name(int level)
Name the log level.
Definition: Log.cpp:39
MultiStream & operator<<(MultiStream &st, T val)
Streaming to the log file and the terminal.
Definition: Log.hpp:134