SUNphi  1.0
Logger.hpp File Reference

Header file to define a logger wrapping FILE*. More...

#include <cstdio>
#include <Threads.hpp>
#include <debug/BackTracing.hpp>
#include <debug/Crash.hpp>
#include <ios/File.hpp>
#include <ios/TextFormat.hpp>
#include <system/Mpi.hpp>
#include <system/Timer.hpp>
#include <utility/Macros.hpp>
#include <utility/ScopeDoer.hpp>

Go to the source code of this file.

Classes

class  SUNphi::Logger
 Write output to a file, using different level of indentation. More...
 
class  SUNphi::Logger::LoggerLine
 Single line in the logger. More...
 
class  SUNphi::ScopeIndenter
 Increment the logger indentation level for the object scope. More...
 

Macros

#define RUNLOG   runLog()
 Create the line.
 

Variables

Logger SUNphi::runLog
 Global logger.
 

Detailed Description

Header file to define a logger wrapping FILE*.

The internal class is used to really print, while the external one to determine whether to print or not, and to lock in case the threads are present. If printing is not needed, a fake internal logger is passed, printing on /dev/null

If threads are running, and all threads are allowed to print, the Logger is locked so that only one thread at the time can print, and all lines are prepended with thread id indication.

If MPI is running, and all ranks are allowed, to print, each line is prepended with the rank id. No cross-ranks lock is issued.

Definition in file Logger.hpp.