v0.15.0
Loading...
Searching...
No Matches
Mofem_log_manager

Log manager. More...

Collaboration diagram for Mofem_log_manager:

Classes

struct  MoFEM::LogManager
 Log manager is used to build and partition problems. More...
 

Macros

#define MOFEM_LOG_CHANNEL(channel)
 Set and reset channel.
 
#define MOFEM_LOG_ATTRIBUTES(channel, bit)
 Add attributes to channel.
 
#define MOFEM_LOG(channel, severity)
 Log.
 
#define MOFEM_LOG_FUNCTION()
 Set scope.
 
#define MOFEM_LOG_TAG(channel, tag)
 Tag channel.
 

Enumerations

enum  MoFEM::LogManager::SeverityLevel {
  MoFEM::LogManager::noisy , MoFEM::LogManager::verbose , MoFEM::LogManager::inform , MoFEM::LogManager::warning ,
  MoFEM::LogManager::error
}
 Severity levels. More...
 
enum  MoFEM::LogManager::LogAttributesBits { MoFEM::LogManager::BitLineID = 1 << 0 , MoFEM::LogManager::BitScope = 1 << 1 }
 Tag attributes switches. More...
 

Functions

static void MoFEM::LogManager::addAttributes (LogManager::LoggerType &lg, const int bit=0)
 Add attributes to logger.
 
static void MoFEM::LogManager::addAttributes (const std::string channel, const int bit=0)
 Add attributes to channel.
 
static LoggerTypeMoFEM::LogManager::setLog (const std::string channel)
 Set ans resset chanel logger.
 
static LoggerTypeMoFEM::LogManager::getLog (const std::string channel)
 Get logger by channel.
 
static void MoFEM::LogManager::addTag (LogManager::LoggerType &lg, const std::string tag)
 Add tag to logger.
 
static void MoFEM::LogManager::addTag (const std::string channel, const std::string tag)
 Add tag to channel.
 

Detailed Description

Log manager.

Logging manager based on Boost.Log (Boost.Log v2)

Macro Definition Documentation

◆ MOFEM_LOG

#define MOFEM_LOG ( channel,
severity )

#include <src/interfaces/LogManager.hpp>

Value:
BOOST_LOG_SEV(MoFEM::LogManager::getLog(channel), severity)
static LoggerType & getLog(const std::string channel)
Get logger by channel.

Log.

MOFEM_LOG("WORLD", LogManager::SeverityLevel::inform) << "Hello world";
#define MOFEM_LOG(channel, severity)
Log.
Examples
EshelbianOperators.cpp, EshelbianPlasticity.cpp, PlasticOpsMonitor.hpp, PoissonDiscontinousGalerkin.hpp, add_cubit_meshsets.cpp, approx_sphere.cpp, build_large_problem.cpp, child_and_parent.cpp, continuity_check_on_skeleton_3d.cpp, continuity_check_on_skeleton_with_simple_2d_for_h1.cpp, continuity_check_on_skeleton_with_simple_2d_for_hcurl.cpp, dg_projection.cpp, dm_build_partitioned_mesh.cpp, dynamic_first_order_con_law.cpp, eigen_elastic.cpp, elasticity.cpp, ep.cpp, field_evaluator.cpp, forces_and_sources_testing_users_base.cpp, free_surface.cpp, gauss_points_on_outer_product.cpp, hanging_node_approx.cpp, hdiv_check_approx_in_3d.cpp, hdiv_divergence_operator.cpp, heat_equation.cpp, hello_world.cpp, helmholtz.cpp, higher_derivatives.cpp, level_set.cpp, log.cpp, matrix_function.cpp, mixed_poisson.cpp, operators_tests.cpp, phase.cpp, photon_diffusion.cpp, plastic.cpp, plate.cpp, plot_base.cpp, poisson_2d_dis_galerkin.cpp, remove_entities_from_problem.cpp, remove_entities_from_problem_not_partitioned.cpp, scalar_check_approximation.cpp, schur_test_diag_mat.cpp, seepage.cpp, shallow_wave.cpp, simple_interface.cpp, simple_l2_only.cpp, split_sideset.cpp, tensor_divergence_operator.cpp, test_broken_space.cpp, test_cache_on_entities.cpp, thermo_elastic.cpp, and wave_equation.cpp.

Definition at line 316 of file LogManager.hpp.

316 #define MOFEM_LOG(channel, severity) \
317 BOOST_LOG_SEV(MoFEM::LogManager::getLog(channel), severity)

◆ MOFEM_LOG_ATTRIBUTES

#define MOFEM_LOG_ATTRIBUTES ( channel,
bit )

#include <src/interfaces/LogManager.hpp>

Value:
static void addAttributes(LogManager::LoggerType &lg, const int bit=0)
Add attributes to logger.
auto bit
set bit

Add attributes to channel.

MOFEM_LOG_ATTRIBUTES("SYNC", LogManager::BitLineID | LogManager::BitScope);
#define MOFEM_LOG_ATTRIBUTES(channel, bit)
Add attributes to channel.
Examples
add_cubit_meshsets.cpp, continuity_check_on_skeleton_with_simple_2d_for_h1.cpp, log.cpp, and matrix_function.cpp.

Definition at line 304 of file LogManager.hpp.

304 #define MOFEM_LOG_ATTRIBUTES(channel, bit) \
305 { MoFEM::LogManager::addAttributes(channel, bit); }

◆ MOFEM_LOG_CHANNEL

#define MOFEM_LOG_CHANNEL ( channel)

#include <src/interfaces/LogManager.hpp>

Value:
static LoggerType & setLog(const std::string channel)
Set ans resset chanel logger.

Set and reset channel.

#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.

Are three default type of channels, SELF, each processor prints to the standard output, WORLD, only processor one prints, and SYNC all processors prints synchronously.

Examples
EshelbianPlasticity.cpp, HenckyOps.hpp, PlasticOps.hpp, ThermoElasticOps.hpp, add_cubit_meshsets.cpp, build_large_problem.cpp, free_surface.cpp, hcurl_divergence_operator_2d.cpp, log.cpp, partition_mesh.cpp, phase.cpp, plastic.cpp, poisson_2d_homogeneous.cpp, remove_entities_from_problem_not_partitioned.cpp, schur_test_diag_mat.cpp, seepage.cpp, test_cache_on_entities.cpp, and thermo_elastic.cpp.

Definition at line 292 of file LogManager.hpp.

292 #define MOFEM_LOG_CHANNEL(channel) \
293 { MoFEM::LogManager::setLog(channel); }

◆ MOFEM_LOG_FUNCTION

#define MOFEM_LOG_FUNCTION ( )

#include <src/interfaces/LogManager.hpp>

Value:
BOOST_LOG_NAMED_SCOPE_INTERNAL( \
BOOST_LOG_UNIQUE_IDENTIFIER_NAME(_boost_log_named_scope_sentry_), \
PETSC_FUNCTION_NAME, __FILE__, __LINE__, \
::boost::log::attributes::named_scope_entry::function)

Set scope.

Macro for function scope markup. The scope name is constructed with help of compiler and contains the current function signature. The scope name is pushed to the end of the current thread scope list.

Not all compilers have support for this macro. The exact form of the scope name may vary from one compiler to another.

Examples
continuity_check_on_skeleton_with_simple_2d_for_h1.cpp, and log.cpp.

Definition at line 333 of file LogManager.hpp.

333 #define MOFEM_LOG_FUNCTION() \
334 BOOST_LOG_NAMED_SCOPE_INTERNAL( \
335 BOOST_LOG_UNIQUE_IDENTIFIER_NAME(_boost_log_named_scope_sentry_), \
336 PETSC_FUNCTION_NAME, __FILE__, __LINE__, \
337 ::boost::log::attributes::named_scope_entry::function)

◆ MOFEM_LOG_TAG

Enumeration Type Documentation

◆ LogAttributesBits

Tag attributes switches.

Enumerator
BitLineID 
BitScope 

Definition at line 47 of file LogManager.hpp.

47 {
48 BitLineID = 1 << 0,
49 BitScope = 1 << 1,
50 };

◆ SeverityLevel

Severity levels.

Enumerator
noisy 
verbose 
inform 
warning 
error 

Definition at line 33 of file LogManager.hpp.

Function Documentation

◆ addAttributes() [1/2]

void MoFEM::LogManager::addAttributes ( const std::string channel,
const int bit = 0 )
static

#include <src/interfaces/LogManager.hpp>

Add attributes to channel.

Parameters
channel
bit

Definition at line 380 of file LogManager.cpp.

380 {
381 addAttributes(getLog(channel), bit);
382}

◆ addAttributes() [2/2]

void MoFEM::LogManager::addAttributes ( LogManager::LoggerType & lg,
const int bit = 0 )
static

#include <src/interfaces/LogManager.hpp>

Add attributes to logger.

Parameters
lg
bit

Definition at line 362 of file LogManager.cpp.

362 {
363
364 if (bit == 0)
365 return;
366
367 if (bit & (BitLineID | BitScope)) {
368
369 if (bit & BitLineID)
370 lg.add_attribute("LineID", attrs::counter<unsigned int>(1));
371
372 if (bit & BitScope)
373 lg.add_attribute("Scope", attrs::named_scope());
374
375 } else {
376 THROW_MESSAGE("Wrong cast");
377 }
378}
#define THROW_MESSAGE(msg)
Throw MoFEM exception.

◆ addTag() [1/2]

void MoFEM::LogManager::addTag ( const std::string channel,
const std::string tag )
static

#include <src/interfaces/LogManager.hpp>

Add tag to channel.

Parameters
channel
tag

Definition at line 388 of file LogManager.cpp.

388 {
389 getLog(channel).add_attribute("Tag", attrs::constant<std::string>(tag));
390}

◆ addTag() [2/2]

void MoFEM::LogManager::addTag ( LogManager::LoggerType & lg,
const std::string tag )
static

#include <src/interfaces/LogManager.hpp>

Add tag to logger.

Parameters
lg
tag

Definition at line 384 of file LogManager.cpp.

384 {
385 lg.add_attribute("Tag", attrs::constant<std::string>(tag));
386}

◆ getLog()

LogManager::LoggerType & MoFEM::LogManager::getLog ( const std::string channel)
static

#include <src/interfaces/LogManager.hpp>

Get logger by channel.

Parameters
channel
Returns
LoggerType&

Definition at line 398 of file LogManager.cpp.

398 {
399 auto it = InternalData::logChannels.find(channel);
400 if (it == InternalData::logChannels.end()) {
402 "Channel <" + channel + "> not found");
403 }
404 return it->second;
405}
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
@ MOFEM_DATA_INCONSISTENCY
Definition definitions.h:31
static std::map< std::string, LoggerType > logChannels

◆ setLog()

LogManager::LoggerType & MoFEM::LogManager::setLog ( const std::string channel)
static

#include <src/interfaces/LogManager.hpp>

Set ans resset chanel logger.

Parameters
channel
Returns
LoggerType&

Definition at line 392 of file LogManager.cpp.

392 {
394 LoggerType(boost::log::keywords::channel = channel);
395 return InternalData::logChannels[channel];
396}
boost::log::sources::severity_channel_logger< SeverityLevel, std::string > LoggerType
Definition of the channel logger.