All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Private Types | Private Member Functions | List of all members
blaze::logging::Logger Class Reference

Implementation of a logger class.The Logger class represents the core of the logging functionality. It is responsible for commiting logging messages immediately to the according log file(s). The logger works for both serial as well as MPI parallel environments. In case of a non-MPI-parallel simulation the Logger creates the log file 'blaze.log', which contains all logging information from all logging levels. In case of a MPI parallel simulation, each process creates his own individual log file called 'blazeX.log', where 'X' is replaced by the according rank the process has in the MPI_COMM_WORLD communicator.
Note that the log file(s) are only created in case any logging information is created. This might for instance result in only a small number of log file(s) in MPI parallel simulations when only some of the processes encounter errors/warnings/etc.
Note that the logging functionality may not be used before MPI_Init() has been finished. In consequence, this means that no global data that is initialized before the main() function may contain any use of the logging functionality! More...

#include <Logger.h>

Inherits blaze::Singleton< Logger, SystemClock >.

Public Member Functions

Destructor
 ~Logger ()
 Destructor for the Logger class.
 

Private Types

typedef Singleton< Logger,
SystemClock, NullType,
NullType, NullType, NullType,
NullType, NullType, NullType
SingletonType
 Type of this Singleton instance.
 

Private Member Functions

typedef BLAZE_TYPELIST_8 (SystemClock, NullType, NullType, NullType, NullType, NullType, NullType, NullType) Dependencies
 Type list of all lifetime dependencies.
 
Constructors
 Logger ()
 Constructor for the Logger class.
 
Logging functions
template<typename Type >
void log (const Type &message)
 Writes the log message to the log file.
 
Utility functions
void openLogFile ()
 Opens and initializes the log file.
 

Static Private Member Functions

Instance function
static boost::shared_ptr< Loggerinstance ()
 

Private Attributes

Member variables
boost::mutex mutex_
 Synchronization mutex for thread-parallel logging.
 
std::ofstream log_
 The log file.
 

Static Private Attributes

Member variables
static boost::mutex instanceMutex_
 Synchronization mutex for access to the singleton.
 

Detailed Description

Implementation of a logger class.

The Logger class represents the core of the logging functionality. It is responsible for commiting logging messages immediately to the according log file(s). The logger works for both serial as well as MPI parallel environments. In case of a non-MPI-parallel simulation the Logger creates the log file 'blaze.log', which contains all logging information from all logging levels. In case of a MPI parallel simulation, each process creates his own individual log file called 'blazeX.log', where 'X' is replaced by the according rank the process has in the MPI_COMM_WORLD communicator.
Note that the log file(s) are only created in case any logging information is created. This might for instance result in only a small number of log file(s) in MPI parallel simulations when only some of the processes encounter errors/warnings/etc.
Note that the logging functionality may not be used before MPI_Init() has been finished. In consequence, this means that no global data that is initialized before the main() function may contain any use of the logging functionality!

Constructor & Destructor Documentation

blaze::logging::Logger::~Logger ( )

Destructor for the Logger class.

The destructor of the Logger class writes the bottom line of the log file and closes the file.

Member Function Documentation

template<typename Type >
void blaze::logging::Logger::log ( const Type &  message)
private

Writes the log message to the log file.

Parameters
messageThe log message to be logged.
Returns
void

This function immediately commits the log message to the log file. The first call to this function will create the log file.

void blaze::logging::Logger::openLogFile ( )
private

Opens and initializes the log file.

Returns
void

This function is responsible for opening the log file and writing the header line. In case of a non-MPI-parallel simulation the function creates the log file 'blaze.log', which contains all logging information from all logging levels. In case of a MPI parallel simulation, each process creates his own individual log file called 'blazeX.log', where 'X' is replaced by the according rank the process has in the MPI_COMM_WORLD communicator.


The documentation for this class was generated from the following files: