25 bool scientific =
true;
36 template <
typename... TArgs>
39 writeImpl(ss, std::forward<TArgs>(args)...);
48 precision = newPrecision;
53 scientific = newScientific;
57 template <
typename T0,
typename... TArgs>
58 void writeImpl(std::stringstream& ss, T0&& first, TArgs&&... rest) {
59 ss << std::setprecision(precision);
61 ss << std::scientific;
64 writeImpl(ss, std::forward<TArgs>(rest)...);
66 void writeImpl(std::stringstream&
UNUSED(ss)) {}
118 stream <<
"\033[" << int(mod.
bg) <<
"m";
121 stream <<
"\033[" << int(mod.
fg) <<
"m";
123 stream <<
"\e[" << int(mod.
series) <<
"m";
140 virtual void writeString(
const std::string& s)
override;
147 std::stringstream ss;
150 virtual void writeString(
const std::string& s)
override;
191 virtual void writeString(
const std::string& s)
override;
203 return loggers.
size();
207 loggers.
push(std::move(logger));
211 for (
auto& l : loggers) {
242 #define VERBOSE_LOG VerboseLogGuard __verboseLogGuard(__PRETTY_FUNCTION__);
Generic dynamically allocated resizable storage.
Simplified implementation of std::unique_ptr, using only default deleter.
Wrapper over enum allowing setting (and querying) individual bits of the stored value.
const EmptyFlags EMPTY_FLAGS
Global parameters of the code.
uint32_t Size
Integral type used to index arrays (by default).
constexpr int PRECISION
Number of valid digits of numbers on output.
void setVerboseLogger(AutoPtr< ILogger > &&logger)
Creates a global verbose logger.
#define NAMESPACE_SPH_END
Object representing a path on a filesystem, similar to std::filesystem::path in c++17.
Measuring time intervals and executing periodic events.
Generic dynamically allocated resizable storage.
INLINE void push(U &&u)
Adds new element to the end of the array, resizing the array if necessary.
INLINE TCounter size() const noexcept
virtual void writeString(const std::string &s) override
Logs a string message.
FileLogger(const Path &path, const Flags< Options > flags=EMPTY_FLAGS)
@ ADD_TIMESTAMP
Adds a time of writing before each message.
Interface providing generic (text, human readable) output of the program.
void setPrecision(const Size newPrecision)
Changes the precision of printed numbers.
virtual void writeString(const std::string &s)=0
Logs a string message.
void write(TArgs &&... args)
Creates and logs a message by concatenating arguments.
void setScientific(const bool newScientific)
Sets/unsets scientific notation.
Class holding multiple loggers and writing messages to all of them.
void add(AutoPtr< ILogger > &&logger)
Size getLoggerCnt() const
virtual void writeString(const std::string &s) override
Logs a string message.
Helper logger that does not write anything.
virtual void writeString(const std::string &UNUSED(s)) override
Object representing a path on a filesystem.
virtual void writeString(const std::string &s) override
Logs a string message.
Logger writing messages to string stream.
virtual void writeString(const std::string &s) override
Logs a string message.
void clean()
Removes all written messages from the string.
std::string toString() const
Returns all written messages as a string. Messages are not erased from the logger by this.
Basic time-measuring tool. Starts automatically when constructed.
RAII guard writing called functions and their durations to a special verbose logger.
VerboseLogGuard(const std::string &functionName)
Creates a guard, should be at the very beginning of a function/scope.
friend std::ostream & operator<<(std::ostream &stream, const Console &mod)
Console(const Background bg)
enum Console::Foreground fg
enum Console::Series series
enum Console::Background bg
Console(const Foreground fg)
Console(const Series series)
Object with deleted copy constructor and copy operator.
Base class for all polymorphic objects.
ScopedConsole(const Console console)