SyTen
log.h File Reference

Logging facilities. More...

#include <fstream>
#include <mutex>
#include <iostream>
#include <iomanip>
#include "inc/util/shift_args.h"
#include "inc/util/time_output.h"
#include "inc/util/toggle_enums.h"
#include "inc/util/is_not_streamcontrol.h"
#include "inc/util/format.h"
+ Include dependency graph for log.h:
+ This graph shows which files directly or indirectly include this file:

Classes

struct  syten::Fmt
 Used by the logging infrastructure to indicate that the first argument is a format string and a newline should be added automatically. More...
 
struct  syten::FmtNN
 Used by the logging infrastructure to indicate that the first argument is a format string and no newline should be added automatically. More...
 
struct  syten::NoPrefix
 Used by the logging infrastructure to indicate that no prefix should be printed in front of the line. More...
 

Namespaces

namespace  syten
 Syten namespace.
 
namespace  syten::Log
 Global variables for the logging subsystem.
 

Typedefs

using syten::Log::PrintPrefix = YesNo< struct _print_prefix >
 Used to indicate that the prefix should be printed. More...
 
using syten::Log::StreamIsTTY = YesNo< struct _stream_is_tty >
 Used to indicate that the supplied stream is a TTY. More...
 

Functions

template<typename... Args>
std::string syten::Log::format_args (Args &&... data)
 Constructs a text representation of a series of objects by shifting them into a std::stringstream. More...
 
std::string syten::Log::format_args (char const *c)
 Overload for format_args() taking a single C character array. More...
 
template<typename... Args>
std::string syten::Log::format_args (Fmt fmt, Args &&... data)
 Constructs a text representation of a series of objects by calling fmt::format() using the format string stored in the first one as the format specifier. More...
 
template<typename... Args>
std::string syten::Log::format_args (FmtNN fmt, Args &&... data)
 Constructs a text representation of a series of objects by calling fmt::format() using the format string stored in the first one as the format specifier. More...
 
std::string syten::Log::format_args (std::string const &s)
 Overload for format_args() taking a single string. More...
 
void syten::Log::initLogsP1 ()
 Sets stdcerr_is_tty. More...
 
void syten::Log::initLogsP2 ()
 Initialises the file streams if timing_log_name and/or generic_log_name are set and the log levels are greater than none. More...
 
template<typename... Args>
void syten::Log::log_impl (PrintPrefix pp, int level, std::ofstream &filestream, std::ostream &ttystream, Args &&... data)
 Implementation helper to decide if we need to generate logging output and where to put it. More...
 
void syten::Log::log_output (PrintPrefix pp, StreamIsTTY tty, int level, std::ostream &output_stream, std::string const &str)
 Outputs the supplied string to the supplied file stream. More...
 
template<typename... Args>
void syten::logE (int level, Args &&... data)
 Logs data of the specified level to the standard file streams and std::cerr and prints the prefix. More...
 
template<typename... Args>
void syten::logE (int level, NoPrefix, Args &&... data)
 Logs data of the specified level to the standard file streams and std::cerr and does not print the prefix. More...
 
template<typename... Args>
void syten::logGD (Args &&... data)
 Logs generic debugging data to the standard file streams and std::cerr. More...
 
template<typename... Args>
void syten::logGd (Args &&... data)
 Logs generic extra debugging data to the standard file streams and std::cerr. More...
 
template<typename... Args>
void syten::logGE (Args &&... data)
 Logs generic errors to the standard file streams and std::cerr. More...
 
template<typename... Args>
void syten::logGI (Args &&... data)
 Logs generic informational data to the standard file streams and std::cerr. More...
 
template<typename... Args>
void syten::logGI_O (Args &&... data)
 Logs generic informational data to the standard file streams and std::cout. More...
 
template<typename... Args>
void syten::logGN (Args &&... data)
 Logs generic notices to the standard file streams and std::cerr. More...
 
template<typename... Args>
void syten::logGW (Args &&... data)
 Logs generic warnings to the standard file streams and std::cerr. More...
 
template<typename... Args>
void syten::logO (int level, Args &&... data)
 Logs data of the specified level to the standard file streams and std::cout and prints the prefix. More...
 
template<typename... Args>
void syten::logO (int level, NoPrefix, Args &&... data)
 Logs data of the specified level to the standard file streams and std::cout and does not print the prefix. More...
 
template<typename... Args>
void syten::logTI (Args &&... data)
 Logs informational timing data to the standard file streams and std::cerr. More...
 
template<typename... Args>
void syten::logTV (Args &&... data)
 Logs verbose timing data to the standard file streams and std::cerr. More...
 
template<typename... Args>
void syten::logTx (Args &&... data)
 Logs extra-verbose timing data to the standard file streams and std::cerr. More...
 
template<typename... Args>
void syten::logTX (Args &&... data)
 Logs EXTRA-verbose timing data to the standard file streams and std::cerr. More...
 

Variables

int constexpr syten::Log::G::ddebug = 6
 extra debug data, disabled by default More...
 
int constexpr syten::Log::G::debug = 5
 debug logging data, disabled by default More...
 
int constexpr syten::Log::G::error = 1
 error logging data, enabled by default (all clear errors) More...
 
int constexpr syten::Log::T::info = 101
 informational timing data for outer-loop timings (DMRG sweeps, for example), enabled by default More...
 
int constexpr syten::Log::G::info = 4
 informational logging data, enabled by default ('What you are doing') More...
 
int constexpr syten::Log::T::none = 100
 no timing data More...
 
int constexpr syten::Log::G::none = 0
 no logging data More...
 
int constexpr syten::Log::G::notice = 3
 notice logging data, enabled by default ('results of what you did') More...
 
int constexpr syten::Log::T::verb = 102
 verbose timing data for inner-loop timings, disabled by default More...
 
int constexpr syten::Log::G::warning = 2
 warning logging data, enabled by default (unexpected results) More...
 
int constexpr syten::Log::T::Xverb = 104
 extra-extra verbose timing data More...
 
int constexpr syten::Log::T::xverb = 103
 extra-verbose timing data More...
 

Detailed Description

Logging facilities.