13#include <unordered_map>
14#include <source_location>
27 virtual void logMsg(
const char * i_msg,
const char * i_extra = NULL)
noexcept = 0;
30 virtual void logFormatted(
const char * i_format, ...) noexcept = 0;
36 virtual const std::
string timeStamp(
void) noexcept = 0;
39 virtual
void setRank(
int i_rank,
int i_worldSize) noexcept = 0;
45 virtual ~ILog(
void)
noexcept = 0;
48 virtual void logErr(
const std::exception & i_ex,
const char * i_msg = NULL)
noexcept = 0;
51 virtual void logSql(
const char * i_sql)
noexcept = 0;
64 const char * i_basePath,
66 bool i_useTimeStamp =
false,
67 bool i_usePidStamp =
false,
68 bool i_noMsgTime =
false,
69 bool i_isLogSql =
false
73 virtual const std::
string lastLogPath(
void) noexcept = 0;
76 virtual const std::
string stampedLogPath(
void) noexcept = 0;
79 virtual const std::
string getMessage(const
char * i_sourceMsg) noexcept = 0;
82 virtual const std::list<std::
string> getLanguages(
void) noexcept = 0;
85 virtual const std::unordered_map<std::
string, std::
string> getLanguageMessages(
void) noexcept = 0;
88 virtual
void swapLanguageMessages(const std::list<std::
string> & i_langLst, std::unordered_map<std::
string, std::
string> & io_msgMap) noexcept = 0;
94 virtual ~ITrace(
void)
noexcept = 0;
107 const char * i_basePath,
109 bool i_useTimeStamp =
false,
110 bool i_usePidStamp =
false,
111 bool i_noMsgTime =
false
123#define CHECKPOINT(x) { openm::the_checkpoint_location = std::source_location::current(); openm::the_checkpoint_message = x; }
126#define LOG_CHECKPOINT \
127 theLog->logFormatted("%s: [%d,%d] %s", \
128 the_checkpoint_message, \
129 the_checkpoint_location.line(), the_checkpoint_location.column(), the_checkpoint_location.file_name());
149#define LT(sourceMessage) ((theLog->getMessage(sourceMessage)).c_str())
152#define NO_LT(sourceMessage) sourceMessage
openM++ namespace
Definition: log.h:32
thread_local std::source_location the_checkpoint_location
checkpoint source code location: file name, line and column
Definition: omLog.h:119
thread_local const char * the_checkpoint_message
checkpoint log message
Definition: omLog.h:116
openm::ITrace * theTrace
trace log global instance: model debug output to console and log files
Definition: log.cpp:34
openm::ILog * theLog
log global instance: log to console and into log files
Definition: log.cpp:28
base for log public interface
Definition: omLog.h:20
virtual void logMsg(const char *i_msg, const char *i_extra=NULL) noexcept=0
log message
virtual const bool isEnabled(void) noexcept=0
return true if log to console or to file enabled
virtual const std::string timeStamp(void) noexcept=0
return timestamp part of log file name: 2012_08_17_16_04_59_148.
virtual void setRank(int i_rank, int i_worldSize) noexcept=0
use process rank as log message prefix
virtual void logFormatted(const char *i_format,...) noexcept=0
log message formatted with vsnprintf()
log public interface: log to console and into log files
Definition: omLog.h:44
virtual void init(bool i_logToConsole, const char *i_basePath, bool i_logToFile, bool i_useTimeStamp=false, bool i_usePidStamp=false, bool i_noMsgTime=false, bool i_isLogSql=false) noexcept=0
re-initialize log file name(s) and other log settings.
virtual void logErr(const std::exception &i_ex, const char *i_msg=NULL) noexcept=0
log exception
virtual void logSql(const char *i_sql) noexcept=0
log sql query
trace log public interface: model event log to console and into log files
Definition: omLog.h:93
virtual void init(bool i_logToConsole, const char *i_basePath, bool i_logToFile, bool i_useTimeStamp=false, bool i_usePidStamp=false, bool i_noMsgTime=false) noexcept=0
re-initialize log file name(s) and other log settings.