v0.16.3
Loading...
Searching...
No Matches
Classes | Macros | Enumerations | Functions
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)    { MoFEM::LogManager::setLog(channel); }
 Set and reset channel.
 
#define MOFEM_LOG_ATTRIBUTES(channel, bit)    { MoFEM::LogManager::addAttributes(channel, bit); }
 Add attributes to channel.
 
#define MOFEM_LOG(channel, severity)    BOOST_LOG_SEV(MoFEM::LogManager::getLog(channel), severity)
 Log.
 
#define MOFEM_LOG_FUNCTION()
 Set scope.
 
#define MOFEM_LOG_TAG(channel, tag)   MoFEM::LogManager::addTag(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 LoggerType & MoFEM::LogManager::setLog (const std::string channel)
 Set ans resset chanel logger.
 
static LoggerType & MoFEM::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 
)     BOOST_LOG_SEV(MoFEM::LogManager::getLog(channel), severity)

#include <src/interfaces/LogManager.hpp>

Log.

MOFEM_LOG("WORLD", LogManager::SeverityLevel::inform) << "Hello world";
#define MOFEM_LOG(channel, severity)
Log.
Examples
mofem/atom_tests/add_cubit_meshsets.cpp, mofem/atom_tests/build_large_problem.cpp, mofem/atom_tests/child_and_parent.cpp, mofem/atom_tests/continuity_check_on_skeleton_3d.cpp, mofem/atom_tests/continuity_check_on_skeleton_with_simple_2d_for_h1.cpp, mofem/atom_tests/continuity_check_on_skeleton_with_simple_2d_for_hcurl.cpp, mofem/atom_tests/dg_projection.cpp, mofem/atom_tests/dm_build_partitioned_mesh.cpp, mofem/atom_tests/dm_partitioned_no_field.cpp, mofem/atom_tests/field_evaluator.cpp, mofem/atom_tests/find_local_coordinates.cpp, mofem/atom_tests/forces_and_sources_testing_users_base.cpp, mofem/atom_tests/gauss_points_on_outer_product.cpp, mofem/atom_tests/hanging_node_approx.cpp, mofem/atom_tests/hdiv_check_approx_in_3d.cpp, mofem/atom_tests/hdiv_divergence_operator.cpp, mofem/atom_tests/higher_derivatives.cpp, mofem/atom_tests/log.cpp, mofem/atom_tests/matrix_function.cpp, mofem/atom_tests/operators_tests.cpp, mofem/atom_tests/remove_entities_from_problem.cpp, mofem/atom_tests/remove_entities_from_problem_not_partitioned.cpp, mofem/atom_tests/scalar_check_approximation.cpp, mofem/atom_tests/schur_test_diag_mat.cpp, mofem/atom_tests/simple_interface.cpp, mofem/atom_tests/simple_l2_only.cpp, mofem/atom_tests/tensor_divergence_operator.cpp, mofem/atom_tests/test_broken_space.cpp, mofem/atom_tests/test_cache_on_entities.cpp, mofem/tools/mesh_cut.cpp, mofem/tools/remove_mofem_meshsets.cpp, mofem/tools/split_sideset.cpp, mofem/tutorials/adv-0_plasticity/plastic.cpp, mofem/tutorials/adv-0_plasticity/src/PlasticOpsMonitor.hpp, mofem/tutorials/adv-3_level_set/level_set.cpp, mofem/tutorials/adv-4_dynamic_first_order_con_law/dynamic_first_order_con_law.cpp, mofem/tutorials/adv-5_poroelasticity/seepage.cpp, mofem/tutorials/adv-6_dg_projection/between_meshes_dg_projection.cpp, mofem/tutorials/clx-0_acoustics/helmholtz.cpp, mofem/tutorials/cor-12_cohesive_interface/arc_length_interface.cpp, mofem/tutorials/fun-0_hello_world/hello_world.cpp, mofem/tutorials/fun-2_plot_base/plot_base.cpp, mofem/tutorials/mix-0_mixed_poisson/mixed_poisson.cpp, mofem/tutorials/mix-1_light_intensity_equation/phase.cpp, mofem/tutorials/scl-6_heat_equation/heat_equation.cpp, mofem/tutorials/scl-7_wave_equation/wave_equation.cpp, mofem/tutorials/vec-10_elasticity_schur/schur_elastic.cpp, mofem/tutorials/vec-1_eigen_elasticity/eigen_elastic.cpp, mofem/tutorials/vec-2_nonlinear_elasticity/src/NonlinearElasticExample.hpp, mofem/tutorials/vec-3_nonlinear_dynamics/nonlinear_dynamic_elastic.cpp, mofem/tutorials/vec-4_shallow_wave/approx_sphere.cpp, mofem/tutorials/vec-4_shallow_wave/shallow_wave.cpp, mofem/tutorials/vec-5_free_surface/free_surface.cpp, mofem/tutorials/vec-6_dg_kirchhoff_plate/plate.cpp, mofem/tutorials/vec-7_shape_optimisation/adjoint.cpp, mofem/tutorials/vec-9_arc_length/src/ArcLengthExample.hpp, mofem/users_modules/adolc-plasticity/adolc_plasticity.cpp, mofem/users_modules/adolc-plasticity/src/ADOLCPlasticityMaterialModels.hpp, and mofem/users_modules/basic_finite_elements/elasticity/elasticity.cpp.

Definition at line 316 of file LogManager.hpp.

◆ MOFEM_LOG_ATTRIBUTES

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

#include <src/interfaces/LogManager.hpp>

Add attributes to channel.

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

Definition at line 304 of file LogManager.hpp.

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

◆ MOFEM_LOG_CHANNEL

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

#include <src/interfaces/LogManager.hpp>

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
mofem/atom_tests/add_cubit_meshsets.cpp, mofem/atom_tests/build_large_problem.cpp, mofem/atom_tests/hcurl_divergence_operator_2d.cpp, mofem/atom_tests/log.cpp, mofem/atom_tests/partition_mesh.cpp, mofem/atom_tests/remove_entities_from_problem_not_partitioned.cpp, mofem/atom_tests/schur_test_diag_mat.cpp, mofem/atom_tests/test_cache_on_entities.cpp, mofem/tutorials/adv-0_plasticity/plastic.cpp, mofem/tutorials/adv-0_plasticity/src/PlasticOps.hpp, mofem/tutorials/adv-5_poroelasticity/seepage.cpp, mofem/tutorials/adv-6_dg_projection/between_meshes_dg_projection.cpp, mofem/tutorials/mix-1_light_intensity_equation/phase.cpp, mofem/tutorials/scl-12_electrostatics/electrostatics.cpp, mofem/tutorials/scl-1_poisson_2d_homogeneous/poisson_2d_homogeneous.cpp, mofem/tutorials/vec-10_elasticity_schur/schur_elastic.cpp, mofem/tutorials/vec-2_nonlinear_elasticity/src/HenckyOps.hpp, mofem/tutorials/vec-2_nonlinear_elasticity/src/NonlinearElasticExample.hpp, mofem/tutorials/vec-3_nonlinear_dynamics/nonlinear_dynamic_elastic.cpp, mofem/tutorials/vec-5_free_surface/free_surface.cpp, mofem/tutorials/vec-7_shape_optimisation/adjoint.cpp, mofem/users_modules/adolc-plasticity/adolc_plasticity.cpp, and project_roughness.cpp.

Definition at line 292 of file LogManager.hpp.

293 { MoFEM::LogManager::setLog(channel); }
static LoggerType & setLog(const std::string channel)
Set ans resset chanel logger.

◆ 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
mofem/atom_tests/continuity_check_on_skeleton_with_simple_2d_for_h1.cpp, and mofem/atom_tests/log.cpp.

Definition at line 333 of file LogManager.hpp.

◆ MOFEM_LOG_TAG

#define MOFEM_LOG_TAG (   channel,
  tag 
)    MoFEM::LogManager::addTag(channel, tag);

#include <src/interfaces/LogManager.hpp>

Tag channel.

Tag channel tag is set until MOFEM_LOG_CHANNEL is called, then new tag can be set.

Examples
mofem/atom_tests/add_cubit_meshsets.cpp, mofem/atom_tests/log.cpp, mofem/atom_tests/operators_tests.cpp, mofem/atom_tests/scalar_check_approximation.cpp, mofem/atom_tests/schur_test_diag_mat.cpp, mofem/atom_tests/simple_interface.cpp, mofem/atom_tests/tensor_divergence_operator.cpp, mofem/atom_tests/test_broken_space.cpp, mofem/atom_tests/test_cache_on_entities.cpp, mofem/tools/remove_mofem_meshsets.cpp, mofem/tools/split_sideset.cpp, mofem/tutorials/adv-0_plasticity/plastic.cpp, mofem/tutorials/adv-3_level_set/level_set.cpp, mofem/tutorials/adv-4_dynamic_first_order_con_law/dynamic_first_order_con_law.cpp, mofem/tutorials/adv-5_poroelasticity/seepage.cpp, mofem/tutorials/cor-12_cohesive_interface/arc_length_interface.cpp, mofem/tutorials/fun-2_plot_base/plot_base.cpp, mofem/tutorials/mix-0_mixed_poisson/mixed_poisson.cpp, mofem/tutorials/scl-6_heat_equation/heat_equation.cpp, mofem/tutorials/scl-7_wave_equation/wave_equation.cpp, mofem/tutorials/scl-8_heat_radiation/radiation.cpp, mofem/tutorials/scl-9_heat_method/heat_method.cpp, mofem/tutorials/vec-0_elasticity/elastic.cpp, mofem/tutorials/vec-10_elasticity_schur/schur_elastic.cpp, mofem/tutorials/vec-11_elastic_tie_mesh/elastic_tie_mesh.cpp, mofem/tutorials/vec-1_eigen_elasticity/eigen_elastic.cpp, mofem/tutorials/vec-2_nonlinear_elasticity/nonlinear_elastic.cpp, mofem/tutorials/vec-3_nonlinear_dynamics/nonlinear_dynamic_elastic.cpp, mofem/tutorials/vec-4_shallow_wave/approx_sphere.cpp, mofem/tutorials/vec-4_shallow_wave/shallow_wave.cpp, mofem/tutorials/vec-5_free_surface/free_surface.cpp, mofem/tutorials/vec-6_dg_kirchhoff_plate/plate.cpp, mofem/tutorials/vec-7_shape_optimisation/adjoint.cpp, mofem/tutorials/vec-9_arc_length/arc_length.cpp, mofem/users_modules/adolc-plasticity/adolc_plasticity.cpp, mofem/users_modules/basic_finite_elements/elasticity/elasticity.cpp, and mofem/users_modules/basic_finite_elements/nonlinear_elasticity/nonlinear_dynamics.cpp.

Definition at line 347 of file LogManager.hpp.

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 381 of file LogManager.cpp.

381 {
382 addAttributes(getLog(channel), bit);
383}
static LoggerType & getLog(const std::string channel)
Get logger by channel.

◆ 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 363 of file LogManager.cpp.

363 {
364
365 if (bit == 0)
366 return;
367
368 if (bit & (BitLineID | BitScope)) {
369
370 if (bit & BitLineID)
371 lg.add_attribute("LineID", attrs::counter<unsigned int>(1));
372
373 if (bit & BitScope)
374 lg.add_attribute("Scope", attrs::named_scope());
375
376 } else {
377 THROW_MESSAGE("Wrong cast");
378 }
379}
#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 389 of file LogManager.cpp.

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

◆ 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 385 of file LogManager.cpp.

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

◆ 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 399 of file LogManager.cpp.

399 {
400 auto it = InternalData::logChannels.find(channel);
401 if (it == InternalData::logChannels.end()) {
403 "Channel <" + channel + "> not found");
404 }
405 return it->second;
406}
#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 393 of file LogManager.cpp.

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