11 #ifndef ATILACALCULATORSOFTWARE_LOGGER_H 12 #define ATILACALCULATORSOFTWARE_LOGGER_H 115 static std::string formatInt(
const int& value,
int size);
123 static std::string formatEncodedLogLevel(
const std::string& str,
LogLevel level);
131 static std::string formatTime(std::string str, time_t
timestamp, tm* t);
141 const std::string& message,
148 static Logger* getInstance();
160 static std::string getLoggingFormat();
166 static std::string getDefaultLoggingFormat();
171 static void setVerbosity(
bool verbosity);
177 static void setVerboseLevel(
LogLevel level);
191 static void setVerboseLevels(std::set<LogLevel> levels);
198 static void logToFile(
const std::string& filename,
bool legacy =
true);
203 static void setFileLogging(
bool value);
210 static void setLoggingFormat(std::string format);
217 static size_t trace_s(
const std::string& message);
225 template<
typename... TArgs>
static size_t trace(TArgs
const&... args) {
234 static size_t debug_s(
const std::string& message);
242 template<
typename... TArgs>
static size_t debug(TArgs
const&... args) {
251 static size_t info_s(
const std::string& message);
259 template<
typename... TArgs>
static size_t info(TArgs
const&... args) {
268 static size_t warn_s(
const std::string& message);
276 template<
typename... TArgs>
static size_t warn(TArgs
const&... args) {
285 static size_t error_s(
const std::string& message);
293 template<
typename... TArgs>
static size_t error(TArgs
const&... args) {
302 static size_t fatal_s(
const std::string& message);
310 template<
typename... TArgs>
static size_t fatal(TArgs
const&... args) {
402 #endif // ATILACALCULATORSOFTWARE_LOGGER_H Logging interface that stores logs, allow logfile writing, also contains other output methods...
Definition: logger.h:68
static size_t fatal(TArgs const &... args)
Concatenate and log the given elements as an FATAL entry.
Definition: logger.h:310
static size_t debug(TArgs const &... args)
Concatenate and log the given elements as an DEBUG entry.
Definition: logger.h:242
static size_t trace(TArgs const &... args)
Concatenate and log the given elements as an TRACE entry.
Definition: logger.h:225
static size_t info_s(const std::string &message)
Log an INFO entry from the given string into the logger.
Definition: logger.cpp:228
static size_t error(TArgs const &... args)
Concatenate and log the given elements as an ERROR entry.
Definition: logger.h:293
static LogTimeMode timeMode
Time mode of the log entries (Local or UTC - absolute) Default value is TimeLocal.
Definition: logger.h:363
static Logger * instance
Logger instance.
Definition: logger.h:399
std::vector< entry_listener > listeners
List of listeners that will trigger on new entry.
Definition: logger.h:357
static std::string getLoggingFormat()
Definition: logger.cpp:92
std::ofstream loggingFile
Output file stream for file writing log messages.
Definition: logger.h:352
static std::string logFormat
Current log formatting string, if empty will use defaultLogFormat.
Definition: logger.h:388
static size_t error_s(const std::string &message)
Log an ERROR entry from the given string into the logger.
Definition: logger.cpp:236
Contains the entries of the logger.
Definition: log_entries.h:25
static std::string defaultLogFormat
Default log formatting string.
Definition: logger.h:394
std::string concat(TArgs const &... args)
Cast and concatenate parameter pack elements as string.
Definition: utilities.h:99
static size_t warn_s(const std::string &message)
Log a WARN entry from the given string into the logger.
Definition: logger.cpp:232
static size_t trace_s(const std::string &message)
Log a TRACE entry from the given string into the logger.
Definition: logger.cpp:220
static size_t warn(TArgs const &... args)
Concatenate and log the given elements as an WARN entry.
Definition: logger.h:276
static size_t fatal_s(const std::string &message)
Log a FATAL entry from the given string into the logger.
Definition: logger.cpp:240
LogEntries * entries
Nonformatted raw log entries.
Definition: logger.h:332
static size_t debug_s(const std::string &message)
Log a DEBUG entry from the given string into the logger.
Definition: logger.cpp:224
LogTimeMode
Logging time mode, TimeUTC means use abo.
Definition: common.h:32
bool verbose
If set on true, will show log messages in console.
Definition: logger.h:337
bool fileLogging
If set on true, will write log messages into file.
Definition: logger.h:347
LogLevel
Logging level of a log entry, used to filter log entries, each filtering level will hide lower level ...
Definition: common.h:38
void(* entry_listener)(size_t index, const std::pair< LogMetaData, std::string > &entry, const std::string &formatted, const LogEntries &entries)
Entry listener for Logger, will be called as callback for each new entry in the logger with the given...
Definition: common.h:52
static size_t info(TArgs const &... args)
Concatenate and log the given elements as an INFO entry.
Definition: logger.h:259
std::set< LogLevel > verbosityLevels
Allowed logging levels on verbose (in console)
Definition: logger.h:342