sisi4s
Loading...
Searching...
No Matches
Log.hpp File Reference
#include <util/Time.hpp>
#include <string>
#include <iostream>
#include <streambuf>
#include <fstream>
Include dependency graph for Log.hpp:

Go to the source code of this file.

Classes

class  sisi4s::LogBuffer
 
class  sisi4s::LogStream
 
class  sisi4s::Log
 Class with static members offering control over logging. Log entries are created with the macro LOG. More...
 

Namespaces

namespace  sisi4s
 

Macros

#define _FORMAT(_fmt, ...)
 
#define OUT()
 Provides an output stream for writing a log message of the log level specified by the argument. Note that this macro must be used as a statement and cannot be used as an rvalue.
 
#define WARN()
 
#define NEW_FILE(NAME)
 
#define FILE(NAME)
 
#define LOG(...)
 
#define LOG_RANK(...)
 

Macro Definition Documentation

◆ _FORMAT

#define _FORMAT (   _fmt,
  ... 
)
Value:
([&](void) -> std::string { \
int _sz = std::snprintf(nullptr, 0, _fmt, __VA_ARGS__); \
std::vector<char> _out(_sz + 1); \
std::snprintf(&_out[0], _out.size(), _fmt, __VA_ARGS__); \
return std::string(_out.data()); \
})()

◆ FILE

#define FILE (   NAME)
Value:
if (sisi4s::Log::getRank() != 0) { \
} else std::ofstream(NAME, std::ofstream::app)
static int getRank()
Definition Log.cxx:47

◆ LOG

#define LOG (   ...)
Value:
if (sisi4s::Log::getRank() != 0) { \
} else sisi4s::Log::getLogStream().prepare(0, __FILE__, __VA_ARGS__)
std::ostream & prepare(int const rank, std::string const &sourceFileName, int const level, std::string const &category="")
Definition Log.cxx:19
static LogStream & getLogStream()
Definition Log.cxx:57

◆ LOG_RANK

#define LOG_RANK (   ...)
Value:
__FILE__, \
__VA_ARGS__)

◆ NEW_FILE

#define NEW_FILE (   NAME)
Value:
if (sisi4s::Log::getRank() != 0) { \
} else std::ofstream(NAME, std::ofstream::out)

◆ OUT

#define OUT ( )
Value:
if (sisi4s::Log::getRank() != 0) { \
} else std::cout

Provides an output stream for writing a log message of the log level specified by the argument. Note that this macro must be used as a statement and cannot be used as an rvalue.

◆ WARN

#define WARN ( )
Value:
if (sisi4s::Log::getRank() != 0) { \
} else std::cout << "WARNING: "