17 #ifndef __LOGMANAGER_HPP__
18 #define __LOGMANAGER_HPP__
20 namespace attrs = boost::log::attributes;
21 namespace logging = boost::log;
22 namespace keywords = boost::log::keywords;
23 namespace logging = boost::log;
24 namespace sinks = boost::log::sinks;
25 namespace src = boost::log::sources;
26 namespace attrs = boost::log::attributes;
27 namespace expr = boost::log::expressions;
50 (
char *)
"noisy", (
char *)
"verbose", (
char *)
"inform", (
char *)
"warning",
75 typedef boost::log::sources::severity_channel_logger<
SeverityLevel,
79 typedef sinks::synchronous_sink<sinks::text_ostream_backend>
SinkType;
97 static void addAttributes(
const std::string channel,
const int bit = 0);
142 static void addTag(
const std::string channel,
const std::string tag);
149 static boost::shared_ptr<std::ostream>
getStrmSelf();
163 static boost::shared_ptr<std::ostream>
getStrmSync();
172 static boost::shared_ptr<SinkType>
173 createSink(boost::shared_ptr<std::ostream> stream_ptr,
174 std::string comm_filter);
237 logging::formatting_ostream &strm);
254 namespace LogKeywords {
262 boost::log::attributes::named_scope::value_type)
264 boost::log::attributes::timer::value_type)
288 #define MOFEM_LOG_CHANNEL(channel) \
289 { MoFEM::LogManager::setLog(channel); }
300 #define MOFEM_LOG_ATTRIBUTES(channel, bit) \
301 { MoFEM::LogManager::addAttributes(channel, bit); }
312 #define MOFEM_LOG(channel, severity) \
313 BOOST_LOG_SEV(MoFEM::LogManager::getLog(channel), severity)
315 #define MOFEM_LOG_C(channel, severity, format, ...) \
316 MOFEM_LOG(channel, severity) \
317 << MoFEM::LogManager::getCLikeFormatedString(format, __VA_ARGS__)
329 #define MOFEM_LOG_FUNCTION() \
330 BOOST_LOG_NAMED_SCOPE_INTERNAL( \
331 BOOST_LOG_UNIQUE_IDENTIFIER_NAME(_boost_log_named_scope_sentry_), \
332 PETSC_FUNCTION_NAME, __FILE__, __LINE__, \
333 ::boost::log::attributes::named_scope_entry::function)
343 #define MOFEM_LOG_TAG(channel, tag) MoFEM::LogManager::addTag(channel, tag);
349 #define MOFEM_LOG_SYNCHRONISE(comm) \
350 PetscSynchronizedFlush(comm, MoFEM::LogManager::dummy_mofem_fd);
PetscErrorCode PetscVFPrintfDefault(FILE *fd, const char *format, va_list Argp)
static LoggerType & setLog(const std::string channel)
Set ans resset chanel logger.
SeverityLevel
Severity levels.
LogAttributesBits
Tag attributes switches.
static void addTag(LogManager::LoggerType &lg, const std::string tag)
Add tag to logger.
static void addAttributes(LogManager::LoggerType &lg, const int bit=0)
Add attributes to logger.
static LoggerType & getLog(const std::string channel)
Get logger by channel.
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
BOOST_LOG_ATTRIBUTE_KEYWORD(scope, "Scope", boost::log::attributes::named_scope::value_type) BOOST_LOG_ATTRIBUTE_KEYWORD(timeline
std::bitset< BITINTERFACEUID_SIZE > BitIntefaceId
implementation of Data Operators for Forces and Sources
static const MOFEMuuid IDD_MOFEMLogManager
std::ostream & operator<<(std::ostream &os, const DataForcesAndSourcesCore::EntData &e)
Log manager is used to build and partition problems.
static constexpr std::array< char *const, error+1 > severityStrings
static boost::shared_ptr< SinkType > createSink(boost::shared_ptr< std::ostream > stream_ptr, std::string comm_filter)
Create a sink object.
LogManager(const MoFEM::Core &core)
static MoFEMErrorCode getOptions()
Get logger option.
sinks::synchronous_sink< sinks::text_ostream_backend > SinkType
MoFEMErrorCode query_interface(const MOFEMuuid &uuid, UnknownInterface **iface) const
static std::string getCLikeFormatedString(const char *fmt,...)
Converts formatted output to string.
virtual ~LogManager()=default
static void createDefaultSinks(MPI_Comm comm)
Create default sinks.
boost::log::sources::severity_channel_logger< SeverityLevel, std::string > LoggerType
Definition of the channel logger.
static boost::shared_ptr< std::ostream > getStrmWorld()
Get the strm world object.
static PetscErrorCode logPetscFPrintf(FILE *fd, const char format[], va_list Argp)
Use to handle PETSc output.
static std::string getVLikeFormatedString(const char *fmt, va_list args)
Converts formatted output to string.
static boost::shared_ptr< std::ostream > getStrmSync()
Get the strm sync object.
static void recordFormatterDefault(logging::record_view const &rec, logging::formatting_ostream &strm)
Default record formatter.
static bool checkIfChannelExist(const std::string channel)
Check if channel exist.
static boost::shared_ptr< std::ostream > getStrmSelf()
Get the strm self object.
static std::string petscStringCache
static FILE * dummy_mofem_fd
Dummy file pointer (DO NOT USE)
static boost::shared_ptr< InternalData > internalDataPtr
MoFEM interface unique ID.
base class for all interface classes