MoorDyn
Classes | Namespaces | Macros | Functions
Log.hpp File Reference
#include "MoorDynAPI.h"
#include <iostream>
#include <fstream>
Include dependency graph for Log.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  moordyn::MultiStream
 Streamer able to redirect the output to several substreams. More...
 
class  moordyn::Log
 A Logging utility. More...
 
class  moordyn::LogUser
 A helper for the entities to use the logger. More...
 

Namespaces

 moordyn
 MoorDyn2 C++ API namespace.
 

Macros

#define LOGGER(level)
 Utility to log messages. More...
 
#define LOGDBG   _log->Cout(MOORDYN_DBG_LEVEL)
 Log a debug message, without extra info about the source code.
 
#define LOGMSG   _log->Cout(MOORDYN_MSG_LEVEL)
 Log an info message, without extra info about the source code.
 
#define LOGWRN   LOGGER(MOORDYN_WRN_LEVEL)
 Log a warning.
 
#define LOGERR   LOGGER(MOORDYN_ERR_LEVEL)
 Log an error.
 

Functions

std::string moordyn::log_level_name (int level)
 Name the log level. More...
 
template<class T >
MultiStream & moordyn::operator<< (MultiStream &st, T val)
 Streaming to the log file and the terminal.
 

Detailed Description

Utilities to log info on screen. 2 main classes are provided, moordyn::Log which is the logging handler itself, and moordyn::LogUser which shall be inherited by all the objects which are intended to use the logging handler

Macro Definition Documentation

◆ LOGGER

#define LOGGER (   level)
Value:
_log->Cout(level) << log_level_name(level) << " " << __FILE__ << ":" \
<< __LINE__ << " " << __FUNC_NAME__ << "(): "
#define __FUNC_NAME__
Macro that is substituted by the function name.
Definition: MoorDynAPI.h:93
std::string log_level_name(int level)
Name the log level.
Definition: Log.cpp:39

Utility to log messages.

This macro is assuming you have access to the log handler as the _log variable. The easiest way to grant you can safety use this macro is inheriting the LogUser class