15 #if !defined(KRATOS_LOGGER_H_INCLUDED )
16 #define KRATOS_LOGGER_H_INCLUDED
77 explicit Logger(std::string
const& TheLabel);
114 return defaultOutputInstance;
117 static void AddOutput(LoggerOutput::Pointer pTheOutput);
119 static void RemoveOutput(LoggerOutput::Pointer pTheOutput);
129 return mCurrentMessage.GetMessage();
142 virtual std::string
Info()
const;
145 virtual void PrintInfo(std::ostream& rOStream)
const;
148 virtual void PrintData(std::ostream& rOStream)
const;
152 template<
class StreamValueType>
155 mCurrentMessage << rValue;
237 rOStream << std::endl;
247 #define KRATOS_LOG_OCCURRENCES_LINE(line) kratos_log_loop_counter##line
248 #define KRATOS_LOG_OCCURRENCES KRATOS_LOG_OCCURRENCES_LINE(__LINE__)
250 #define KRATOS_INFO(label) Kratos::Logger(label) << KRATOS_CODE_LOCATION << Kratos::Logger::Severity::INFO
251 #define KRATOS_INFO_IF(label, conditional) if(conditional) Kratos::Logger(label) << KRATOS_CODE_LOCATION << Kratos::Logger::Severity::INFO
253 #define KRATOS_INFO_ONCE(label) static int KRATOS_LOG_OCCURRENCES = -1; if (++KRATOS_LOG_OCCURRENCES == 0) Kratos::Logger(label) << KRATOS_CODE_LOCATION << Kratos::Logger::Severity::INFO
254 #define KRATOS_INFO_FIRST_N(label, logger_count) static int KRATOS_LOG_OCCURRENCES = -1; if (++KRATOS_LOG_OCCURRENCES < logger_count) Kratos::Logger(label) << KRATOS_CODE_LOCATION << Kratos::Logger::Severity::INFO
256 #define KRATOS_INFO_ONCE(label) if(false) KRATOS_INFO(label)
257 #define KRATOS_INFO_FIRST_N(label, logger_count) if(false) KRATOS_INFO(label)
260 #define KRATOS_INFO_ALL_RANKS(label) KRATOS_INFO(label) << Kratos::Logger::DistributedFilter::FromAllRanks()
261 #define KRATOS_INFO_IF_ALL_RANKS(label, conditional) KRATOS_INFO_IF(label, conditional) << Kratos::Logger::DistributedFilter::FromAllRanks()
262 #define KRATOS_INFO_ONCE_ALL_RANKS(label) KRATOS_INFO_ONCE(label) << Kratos::Logger::DistributedFilter::FromAllRanks()
263 #define KRATOS_INFO_FIRST_N_ALL_RANKS(label, logger_count) KRATOS_INFO_FIRST_N(label, logger_count) << Kratos::Logger::DistributedFilter::FromAllRanks()
265 #define KRATOS_WARNING(label) Kratos::Logger(label) << KRATOS_CODE_LOCATION << Kratos::Logger::Severity::WARNING
266 #define KRATOS_WARNING_IF(label, conditional) if(conditional) Kratos::Logger(label) << KRATOS_CODE_LOCATION << Kratos::Logger::Severity::WARNING
268 #define KRATOS_WARNING_ONCE(label) static int KRATOS_LOG_OCCURRENCES = -1; if (++KRATOS_LOG_OCCURRENCES == 0) Kratos::Logger(label) << KRATOS_CODE_LOCATION << Kratos::Logger::Severity::WARNING
269 #define KRATOS_WARNING_FIRST_N(label, logger_count) static int KRATOS_LOG_OCCURRENCES = -1; if (++KRATOS_LOG_OCCURRENCES < logger_count) Kratos::Logger(label) << KRATOS_CODE_LOCATION << Kratos::Logger::Severity::WARNING
271 #define KRATOS_WARNING_ONCE(label) if(false) KRATOS_WARNING(label)
272 #define KRATOS_WARNING_FIRST_N(label, logger_count) if(false) KRATOS_WARNING(label)
275 #define KRATOS_WARNING_ALL_RANKS(label) KRATOS_WARNING(label) << Kratos::Logger::DistributedFilter::FromAllRanks()
276 #define KRATOS_WARNING_IF_ALL_RANKS(label, conditional) KRATOS_WARNING_IF(label, conditional) << Kratos::Logger::DistributedFilter::FromAllRanks()
277 #define KRATOS_WARNING_ONCE_ALL_RANKS(label) KRATOS_WARNING_ONCE(label) << Kratos::Logger::DistributedFilter::FromAllRanks()
278 #define KRATOS_WARNING_FIRST_N_ALL_RANKS(label, logger_count) KRATOS_WARNING_FIRST_N(label, logger_count) << Kratos::Logger::DistributedFilter::FromAllRanks()
280 #define KRATOS_DETAIL(label) Kratos::Logger(label) << KRATOS_CODE_LOCATION << Kratos::Logger::Severity::DETAIL
281 #define KRATOS_DETAIL_IF(label, conditional) if(conditional) Kratos::Logger(label) << KRATOS_CODE_LOCATION << Kratos::Logger::Severity::DETAIL
283 #define KRATOS_DETAIL_ONCE(label) static int KRATOS_LOG_OCCURRENCES = -1; if (++KRATOS_LOG_OCCURRENCES == 0) Kratos::Logger(label) << KRATOS_CODE_LOCATION << Kratos::Logger::Severity::DETAIL
284 #define KRATOS_DETAIL_FIRST_N(label, logger_count) static int KRATOS_LOG_OCCURRENCES = -1; if (++KRATOS_LOG_OCCURRENCES < logger_count) Kratos::Logger(label) << KRATOS_CODE_LOCATION << Kratos::Logger::Severity::DETAIL
286 #define KRATOS_DETAIL_ONCE(label) if(false) KRATOS_DETAIL(label)
287 #define KRATOS_DETAIL_FIRST_N(label, logger_count) if(false) KRATOS_DETAIL(label)
290 #define KRATOS_DETAIL_ALL_RANKS(label) KRATOS_DETAIL(label) << Kratos::Logger::DistributedFilter::FromAllRanks()
291 #define KRATOS_DETAIL_IF_ALL_RANKS(label, conditional) KRATOS_DETAIL_IF(label, conditional) << Kratos::Logger::DistributedFilter::FromAllRanks()
292 #define KRATOS_DETAIL_ONCE_ALL_RANKS(label) KRATOS_DETAIL_ONCE(label) << Kratos::Logger::DistributedFilter::FromAllRanks()
293 #define KRATOS_DETAIL_FIRST_N_ALL_RANKS(label, logger_count) KRATOS_DETAIL_FIRST_N(label, logger_count) << Kratos::Logger::DistributedFilter::FromAllRanks()
296 #define KRATOS_TRACE(label) Kratos::Logger(label) << KRATOS_CODE_LOCATION << Kratos::Logger::Severity::TRACE
297 #define KRATOS_TRACE_IF(label, conditional) if(conditional) Kratos::Logger(label) << KRATOS_CODE_LOCATION << Kratos::Logger::Severity::TRACE
298 #define KRATOS_TRACE_ONCE(label) static int KRATOS_LOG_OCCURRENCES = -1; if (++KRATOS_LOG_OCCURRENCES == 0) Kratos::Logger(label) << KRATOS_CODE_LOCATION << Kratos::Logger::Severity::TRACE
299 #define KRATOS_TRACE_FIRST_N(label, logger_count) static int KRATOS_LOG_OCCURRENCES = -1; if (++KRATOS_LOG_OCCURRENCES < logger_count) Kratos::Logger(label) << KRATOS_CODE_LOCATION << Kratos::Logger::Severity::TRACE
301 #define KRATOS_TRACE(label) if(false) KRATOS_WARNING(label)
302 #define KRATOS_TRACE_IF(label, conditional) if(false) KRATOS_WARNING(label)
303 #define KRATOS_TRACE_ONCE(label) if(false) KRATOS_WARNING(label)
304 #define KRATOS_TRACE_FIRST_N(label, logger_count) if(false) KRATOS_WARNING(label)
307 #define KRATOS_TRACE_ALL_RANKS(label) KRATOS_TRACE(label) << Kratos::Logger::DistributedFilter::FromAllRanks()
308 #define KRATOS_TRACE_IF_ALL_RANKS(label, conditional) KRATOS_TRACE_IF(label, conditional) << Kratos::Logger::DistributedFilter::FromAllRanks()
309 #define KRATOS_TRACE_ONCE_ALL_RANKS(label) KRATOS_TRACE_ONCE(label) << Kratos::Logger::DistributedFilter::FromAllRanks()
310 #define KRATOS_TRACE_FIRST_N_ALL_RANKS(label, logger_count) KRATOS_TRACE_FIRST_N(label, logger_count) << Kratos::Logger::DistributedFilter::FromAllRanks()
312 #if defined(KRATOS_ENABLE_CHECK_POINT)
313 #define KRATOS_CHECK_POINT(label) Kratos::Logger(label) << Kratos::Logger::Category::CHECKING
315 #define KRATOS_CHECK_POINT(label) \
317 Kratos::Logger(label) << Kratos::Logger::Category::CHECKING
std::string Info() const override
Turn back information as a string.
Definition: periodic_interface_process.hpp:93
Definition: code_location.h:31
Logger is in charge of writing the messages to output streams.
Definition: logger.h:57
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: logger.cpp:86
std::string const & GetCurrentMessage()
Definition: logger.h:128
std::vector< LoggerOutput::Pointer > LoggerOutputContainerType
Definition: logger.h:62
Logger(Logger const &rOther)=delete
Avoiding Logger to be copied.
static LoggerOutput & GetDefaultOutputInstance()
Definition: logger.h:111
Logger & operator=(Logger const &rOther)=delete
Loggers can not be assigned.
virtual void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: logger.cpp:82
static LoggerOutputContainerType & GetOutputsInstance()
Definition: logger.h:105
Definition: logger_message.h:80
LoggerMessage class holdes message and the properties of the message.
Definition: logger_message.h:53
Severity
Definition: logger_message.h:64
Category
Definition: logger_message.h:72
LoggerOutput is the base class for all logger outputs.
Definition: logger_output.h:48
def Flush(a)
Definition: DEM_procedures.py:13
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432