Skip to content
Snippets Groups Projects
Commit cfdf0480 authored by Markus Holzer's avatar Markus Holzer
Browse files

Merge branch 'devel/document_logging' into 'master'

document logging

See merge request walberla/walberla!604
parents a839fac6 e173be3d
Branches
No related merge requests found
......@@ -12,3 +12,6 @@
#cmakedefine WALBERLA_LOGLEVEL_PROGRESS
#cmakedefine WALBERLA_LOGLEVEL_DETAIL
#cmakedefine WALBERLA_LOGLEVEL_TRACING
#define WALBERLA_LOGLEVEL ${WALBERLA_LOGLEVEL}
#define WALBERLA_LOGLEVEL_STRING "${WALBERLA_LOGLEVEL}"
\ No newline at end of file
......@@ -43,25 +43,35 @@ const std::string Logging::TRACING_TAG = std::string( "[TRACING ]" );
const uint_t Logging::TAG_WIDTH = uint_t(10);
const uint_t Logging::TIMESTAMP_WIDTH = uint_t(17);
void Logging::setStreamLogLevel( LogLevel logLevel )
{
#ifndef WALBERLA_LOGLEVEL_INFO
if( logLevel == INFO )
logWarning( "You are trying to set the stream log level to INFO, but INFO logs are deactivated by CMake!", "Logging::setStreamLogLevel", -1 );
logWarning( "You are trying to set the stream log level to INFO, but INFO logs are deactivated by CMake!"
"The current WALBERLA_LOGLEVEL is: " WALBERLA_LOGLEVEL_STRING "!"
"Set WALBERLA_LOGLEVEL=INFO to activate INFO logs.",
"Logging::setStreamLogLevel", -1 );
#endif
#ifndef WALBERLA_LOGLEVEL_PROGRESS
if( logLevel == PROGRESS )
logWarning( "You are trying to set the stream log level to PROGRESS, but PROGRESS logs are deactivated by CMake!", "Logging::setStreamLogLevel", -1 );
logWarning( "You are trying to set the stream log level to PROGRESS, but PROGRESS logs are deactivated by CMake!"
"The current WALBERLA_LOGLEVEL is: " WALBERLA_LOGLEVEL_STRING "!"
"Set WALBERLA_LOGLEVEL=PROGRESS to activate PROGRESS logs.",
"Logging::setStreamLogLevel", -1 );
#endif
#ifndef WALBERLA_LOGLEVEL_DETAIL
if( logLevel == DETAIL )
logWarning( "You are trying to set the stream log level to DETAIL, but DETAIL logs are deactivated by CMake!", "Logging::setStreamLogLevel", -1 );
logWarning( "You are trying to set the stream log level to DETAIL, but DETAIL logs are deactivated by CMake!"
"The current WALBERLA_LOGLEVEL is: " WALBERLA_LOGLEVEL_STRING "!"
"Set WALBERLA_LOGLEVEL=DETAIL to activate DETAIL logs.",
"Logging::setStreamLogLevel", -1 );
#endif
#ifndef WALBERLA_LOGLEVEL_TRACING
if( logLevel == TRACING )
logWarning( "You are trying to set the stream log level to TRACING, but TRACING logs are deactivated by CMake!", "Logging::setStreamLogLevel", -1 );
logWarning( "You are trying to set the stream log level to TRACING, but TRACING logs are deactivated by CMake!"
"The current WALBERLA_LOGLEVEL is: " WALBERLA_LOGLEVEL_STRING "!"
"Set WALBERLA_LOGLEVEL=TRACING to activate TRACING logs.",
"Logging::setStreamLogLevel", -1 );
#endif
streamLogLevel_ = logLevel;
}
......@@ -72,19 +82,31 @@ void Logging::setFileLogLevel( LogLevel logLevel )
{
#ifndef WALBERLA_LOGLEVEL_INFO
if( logLevel == INFO )
logWarning( "You are trying to set the file log level to INFO, but INFO logs are deactivated by CMake!", "Logging::setFileLogLevel", -1 );
logWarning( "You are trying to set the file log level to INFO, but INFO logs are deactivated by CMake!"
"The current WALBERLA_LOGLEVEL is: " WALBERLA_LOGLEVEL_STRING "!"
"Set WALBERLA_LOGLEVEL=INFO to activate INFO logs.",
"Logging::setFileLogLevel", -1 );
#endif
#ifndef WALBERLA_LOGLEVEL_PROGRESS
if( logLevel == PROGRESS )
logWarning( "You are trying to set the file log level to PROGRESS, but PROGRESS logs are deactivated by CMake!", "Logging::setFileLogLevel", -1 );
logWarning( "You are trying to set the file log level to PROGRESS, but PROGRESS logs are deactivated by CMake!"
"The current WALBERLA_LOGLEVEL is: " WALBERLA_LOGLEVEL_STRING "!"
"Set WALBERLA_LOGLEVEL=PROGRESS to activate PROGRESS logs.",
"Logging::setFileLogLevel", -1 );
#endif
#ifndef WALBERLA_LOGLEVEL_DETAIL
if( logLevel == DETAIL )
logWarning( "You are trying to set the file log level to DETAIL, but DETAIL logs are deactivated by CMake!", "Logging::setFileLogLevel", -1 );
logWarning( "You are trying to set the file log level to DETAIL, but DETAIL logs are deactivated by CMake!"
"The current WALBERLA_LOGLEVEL is: " WALBERLA_LOGLEVEL_STRING "!"
"Set WALBERLA_LOGLEVEL=DETAIL to activate DETAIL logs.",
"Logging::setFileLogLevel", -1 );
#endif
#ifndef WALBERLA_LOGLEVEL_TRACING
if( logLevel == TRACING )
logWarning( "You are trying to set the file log level to TRACING, but TRACING logs are deactivated by CMake!", "Logging::setFileLogLevel", -1 );
logWarning( "You are trying to set the file log level to TRACING, but TRACING logs are deactivated by CMake!"
"The current WALBERLA_LOGLEVEL is: " WALBERLA_LOGLEVEL_STRING "!"
"Set WALBERLA_LOGLEVEL=TRACING to activate TRACING logs.",
"Logging::setFileLogLevel", -1 );
#endif
fileLogLevel_ = logLevel;
}
......@@ -215,4 +237,4 @@ bool Logging::isInIgnoreCallerPaths( const std::vector< walberla::regex > & rege
} // namespace logging
} // namespace walberla
} // namespace walberla
\ No newline at end of file
......@@ -186,7 +186,7 @@ private:
inline Logging::Logging() : singleton::Singleton<Logging>(),
streamLogLevel_( INFO ), fileLogLevel_( INFO ),
streamLogLevel_( WALBERLA_LOGLEVEL ), fileLogLevel_( WALBERLA_LOGLEVEL ),
processId_( uint_c( mpi::MPIManager::instance()->worldRank() ) ),
numberOfProcesses_( uint_c( mpi::MPIManager::instance()->numProcesses() ) ),
startTime_( timing::WcPolicy::getTimestamp() ), showTimeStamp_( true ), logCallerPath_( false )
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment