22 #include <Threads.hpp> 23 #include <debug/BackTracing.hpp> 24 #include <debug/Crash.hpp> 25 #include <ios/File.hpp> 26 #include <ios/TextFormat.hpp> 27 #include <system/Mpi.hpp> 28 #include <system/Timer.hpp> 29 #include <utility/Macros.hpp> 30 #include <utility/ScopeDoer.hpp> 46 static_cast<
const File&>(*
this);
101 (logger.file()<<durationInSec(timings.currentMeasure())<<
" s").getRc();
105 if(someOtherRankCouldBePrinting)
107 (logger.file()<<
" Rank "<<mpi.rank()).getRc();
110 if(someOtherThreadCouldBePrinting)
112 (logger.file()<<
" Thread "<<threads.getThreadId()).getRc();
116 logger.file()<<
":\t";
119 for(
int i=0;i<logger.indentLev;i++)
176 *
this<<TextColor::DEFAULT;
180 *
this<<TextStyle::RESET;
197 template <
typename T>
200 logger.file()*forw<T>(t);
210 template <
typename T,
240 static_cast<
char>(
c)<<
253 static_cast<
char>(
c)<<
337 using File::alwaysPrintSign;
338 using File::alwaysPrintZero;
339 using File::realFormat;
340 using File::realPrecision;
390 std::move(getNewLine().printVariadicMessage(format,ap));
395 const bool& prependTime=
true)
399 file().open(path,
"w");
#define SCOPE_NOT_ALWAYS_PUT_SIGN(STREAM)
Set not to print always sign at the beginning of a number for current scope.
LoggerLine printVariadicMessage(const char *format, va_list ap)
Print a C-style variadic message.
LoggerLine getNewLine()
Create a new line.
Logger & logger
Reference to the logger.
static Logger fakeLogger
Fake logger, printing to /dev/null.
const bool reallyPrint
Check whether should actually print or not.
LoggerLine(LoggerLine &&oth)
Move constructor.
bool colorChanged
Mark that the color has changed in this line.
void printBacktraceList()
Write the list of called routines.
~ScopeIndenter()
Delete and decrease indent level.
LoggerLine & operator*(T &&t)
Prints after putting a space.
bool styleChanged
Mark that the style has changed in this line.
bool hasToEndLine
Store wether the line has to be ended or not.
void indentMore()
Increase indentation.
const bool hasToLock
Check whether we need to lock.
File & operator<<(const uint64_t &l)
Prints a long unsigned integer.
ScopeIndenter(Logger &logger)
Create and increase indent level.
Logger(const char *path, const bool &prependTime=true)
Create with a path.
Mutex mutex
Mutex used to lock the logger.
bool prependTime
Determine wheter the new line includes time.
Increment the logger indentation level for the object scope.
void endLine()
Ends the line.
Logger runLog("/dev/stdout")
Global logger.
bool hasToCrash
Store whether the line is crashing.
const bool someOtherRankCouldBePrinting
Check if some other rank could be printing.
~LoggerLine()
Destroy (end the line)
LoggerLine & operator<<(const std::string &str)
Prints a c++ string.
void releaseExclusiveAccess()
Release the exclusive access right.
#define SCOPE_REAL_PRECISION(STREAM, VAL)
Set the precision for current scope.
LoggerLine(const LoggerLine &)=delete
Forbids copying a line.
decltype(auto) file(Ts &&...ts)
#define SCOPE_ALWAYS_PRINT_ZERO(STREAM)
Set printing or not zero.
#define PROVIDE_ALSO_NON_CONST_METHOD(NAME)
#define SCOPE_REAL_FORMAT_FIXED(STREAM)
Set fixed for the current scope.
const bool someOtherThreadCouldBePrinting
Check if some other thread could be printing.
const File & file() const
Access to the logger as if it was a file.
void getExclusiveAccess()
Set the exclusive access right.
LoggerLine operator()()
Create a new line.
Logger & logger
Pointed logger.
void indentLess()
Decrease indentation.
LoggerLine(Logger &logger)
Construct.
void startNewLine()
Starts a new line.