|
| v0.14.0
|
Go to the documentation of this file.
15 using namespace MoFEM;
22 BOOST_LOG_SCOPED_THREAD_ATTR(
"Timeline", attrs::timer());
26 MOFEM_LOG(
"WORLD", Sev::verbose) <<
"Hello, world!";
29 std::this_thread::sleep_for(std::chrono::milliseconds(300));
31 MOFEM_LOG(
"WORLD", Sev::verbose) <<
"Hello, second time world!";
41 MOFEM_LOG(
"SYNC", Sev::verbose) <<
"Hello, sync!";
42 MOFEM_LOG(
"SYNC", Sev::verbose) <<
"Hello again, sync!";
54 MOFEM_LOG(
"SYNC", Sev::verbose) <<
"Hello, sync!";
55 MOFEM_LOG(
"SYNC", Sev::verbose) <<
"Hello again, sync!";
62 static char help[] =
"...\n\n";
64 int main(
int argc,
char *argv[]) {
76 CHKERR PetscPrintf(PETSC_COMM_WORLD,
77 "\nTesting logging for obsolete way of printing "
78 "messages\nnext line\nnext line\n\n");
80 CHKERR PetscPrintf(PETSC_COMM_WORLD,
82 CHKERR PetscPrintf(PETSC_COMM_WORLD,
"a ");
83 CHKERR PetscPrintf(PETSC_COMM_WORLD,
86 CHKERR PetscPrintf(PETSC_COMM_WORLD,
"WARNING\n");
91 MOFEM_LOG(
"WORLD", Sev::error) <<
"Hello, self error!";
92 MOFEM_LOG(
"WORLD", Sev::warning) <<
"Hello, self warning!";
93 MOFEM_LOG(
"WORLD", Sev::inform) <<
"Hello, self inform!";
94 MOFEM_LOG(
"WORLD", Sev::verbose) <<
"Hello, self verbose!";
95 MOFEM_LOG(
"WORLD", Sev::noisy) <<
"Hello, self noisy!";
99 MOFEM_LOG_C(
"WORLD", Sev::inform,
"%s %d %d %d",
"Hello C, self error!",
110 auto core_log = logging::core::get();
117 boost::make_shared<std::ofstream>(
"log0.log"),
"ATOM_TEST"));
120 logging::add_file_log(keywords::file_name =
"log1.log",
122 MoFEM::LogKeywords::channel ==
"ATOM_TEST");
125 auto backend = boost::make_shared<sinks::text_ostream_backend>();
126 backend->add_stream(boost::make_shared<std::ofstream>(
"log2.log"));
127 auto sink = boost::make_shared<LogManager::SinkType>(backend);
128 sink->set_filter((expr::has_attr(MoFEM::LogKeywords::channel) &&
129 MoFEM::LogKeywords::channel ==
"ATOM_TEST"));
130 core_log->add_sink(sink);
134 MOFEM_LOG(
"ATOM_TEST", Sev::inform) <<
"Test atom test channel";
int main(int argc, char *argv[])
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.
MoFEMErrorCode log_fun1()
virtual MPI_Comm & get_comm() const =0
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
MoFEMErrorCode log_fun3()
#define MOFEM_LOG_ATTRIBUTES(channel, bit)
Add attributes to channel.
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
static boost::shared_ptr< SinkType > createSink(boost::shared_ptr< std::ostream > stream_ptr, std::string comm_filter)
Create a sink object.
Deprecated interface functions.
DeprecatedCoreInterface Interface
#define MOFEM_LOG_FUNCTION()
Set scope.
#define CHKERR
Inline error check.
implementation of Data Operators for Forces and Sources
#define MOFEM_LOG_C(channel, severity, format,...)
#define MOFEM_LOG_SYNCHRONISE(comm)
Synchronise "SYNC" channel.
static boost::shared_ptr< std::ostream > getStrmSelf()
Get the strm self object.
MoFEMErrorCode log_fun2()
#define MOFEM_LOG_TAG(channel, tag)
Tag channel.
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
#define MOFEM_LOG(channel, severity)
Log.
#define CATCH_ERRORS
Catch errors.
static LoggerType & setLog(const std::string channel)
Set ans resset chanel logger.
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...